1
Hi,
I'm having a problem with my smarty/php/mysql project. I can insert/update/delete from the database, but I cannot seem to view tables of the data in the database.
My viewusers.php code is as follows:
$name = $_POST["name"];
$address = $_POST["address"];
$connection = mysql_connect("localhost", "*******", "*******") or die ("Could not connect");
$db = mysql_select_db("*******", $connection);
$result = mysql_query("SELECT * FROM users") or die(mysql_error());
$number = MYSQL_NUMROWS($result);
$i = 0;
if ($number == 0) {
print "
There are no entries in the table
";
}
else {
PRINT "
";
PRINT "";
PRINT "";
PRINT " Name | ";
PRINT " Address | ";
PRINT "
";
WHILE ($i < $number) {
$name = mysql_result($result,$i,"name");
$address= mysql_result($result,$i,"address");
PRINT "";
PRINT " $name | ";
PRINT " $address | ";
PRINT "
";
$i++;
}
PRINT "
";
PRINT "";
}
?>
Where am I going wrong?