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",""
or die ("Could not connect to the server"
;
$db = mysql_select_db("produce", $conn) or die ("Could not connect to the database"
;
$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