I am attempting to create a MySQL database and table for the first time.
The test code I wrote (PHP 5) retrieves data that I manually inserted into my table and displays it. However, when attempting to INSERT data into that same table from my web page, the code SEEMS to work, but the table is not updated.
Here's the code:
//Sample Database Connection Syntax for PHP and MySQL.
You should really be testing the result from the mysql_query function. Also my preference when developing solutions like this is to use the practice of putting the SQL statement into a variable as follows:
$sql = 'INSERT INTO $usertable (Name, Email, Group) VALUES ("Dianne", "firstname.lastname@example.org", "Newsletter")';
$result = mysql_query($sql);
echo "ERROR: Unable to process SQL: $sql: " . mysql_error() . "\n";
// As there is no results returned there is no need to free up the memory used