Hi everyone.
With difficulties trying to insert data from a form field into a database, I have decided to try to just retrieve the data using a SELECT query. It seems I have no trouble connecting to the database (I previously set up an if...then statement that if connected it echoed "you're in"). Below is the code that I'm using to try to show the rows in the database. Can anyone see any problems? The form that calls this .php file as it's action is simply a button.
<?php
// database connection and error(s)
$dbh=mysql_connect ("localhost", "<myusername>", "<mypass>");
if (!$dbh)
{
echo "could not connect to database";
exit;
}
// insert code
mysql_select_db('<mydatabase>');
$query = "select * from list";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
echo "number of records: '.$num_results.'";
?>
Any help would be excellent!!
Thanks,
Brian