Posted by:
Lost_Girl
(---.nsw01.dataco.com.au)
I am using the following php code shown below, and when i run it under localhost on my computer it doesnt show the results from the database it just gives me blank results even though i do have data in the database, do anyone know how to fix this or can help me with this problem.
<?php
$conn = mysql_connect("localhost","root",""
![winking smiley winking smiley](./mods/smileys/images/smilie3.gif)
or die ("Could not connect to the server"
![winking smiley winking smiley](./mods/smileys/images/smilie3.gif)
;
$db = mysql_select_db("produce", $conn) or die ("Could not connect to the database"
![winking smiley winking smiley](./mods/smileys/images/smilie3.gif)
;
$query = "SELECT * FROM fruit";
$result = mysql_query($query) or die ("Query failed: " .mysql_error());
echo "<table>";
echo "<tr>";
echo "<th> Name </th>";
echo "<th> Number </th>";
echo "</tr>";
while ($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>", $row['$_POST = name'], "</td>";
echo "<td>", $row['$_POST = number'], "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($conn);
?>
Angela