I am having a strange problem that hopefully one of you guru's can help me with. I am new to this, just installed PHP, Apache, and MySQL. I followed the instructions for installing PHP under Windows and am in the process of Testing it all. I have my host up and running. I created the database. I created 2 php files, one for inserting and one for querying.
The insert file works fine. The query doesn't work at all, and I don't know why. Here are the two files:
// Connect to the database
$dbhost = 'localhost';
$dbusername = 'testuser';
$dbpasswd = 'testpassword';
$database_name = 'simple';
$connection = mysql_connect("$dbhost","$dbusername","$dbpasswd")
or die ('Couldn\'t connect to server.');
$db = mysql_select_db("$database_name", $connection)
or die('Couldn\'t select database.');
// Generate SQL code to store data on database.
$insert_sql = 'INSERT INTO simple_table (text) VALUES (\'test text, 1,2,3\')';
// Execute SQL code.
mysql_query( $insert_sql )
or die ( 'It Didn\’t Work: ' . mysql_error() );
// Tell User we are done.
echo 'Code Inserted';