- Code: Select all
<html>
<head>
</head>
<body>
<?php
mysql_connect("localhost", "root", "eucenje") or die(mysql_error());
mysql_select_db("conquer_the_world") or die(mysql_error());
$data = mysql_query("SELECT * FROM country") or die(mysql_error());
Print "<table border='1'>";
while($info = mysql_fetch_array( $data )) {
Print "<tr>";
Print "<th>Name:</th> <td>".$info['name'] . "</td> ";
Print "<th>Pet:</th> <td>".$info['idCountry'] . " </td></tr>";
}
Print "</table>";
?>
</body>
</html>
The output in browser comes:
"; while($info = mysql_fetch_array( $data )) { Print ""; Print "Name: ".$info['name'] . " "; Print "Pet: ".$info['idCountry'] . " "; } Print ""; ?>
I think the problem is that first ">" from table closes php badge



