Hi,
I hope this is the right forum for this. If not, my apologies. I am currently working on a multi-page signup form with lots of database access. Everything was fine until we upgraded to PHP 4.01 and MySQL 3.23.21.
Now, I can no longer add a new row without getting a warning. A quick query of the table shows that the data was actually added.
I don't know if I am doing something wrong (i.e. configuration of PHP, MySQL or a coding error) or it is a bug in PHP. Same error also occurs when you try to add a row using phpMyAdmin. It doesn't seem like an MySQL problem because I can add rows to the the table outside of php.
Here is a sample code snippet to illustrate the problem:
//Connect to MySQL
$connection = mysql_connect($host,$user,$password) or die("No Connection");
//Select the Database
mysql_select_db($database, $connection) or die("Can't Select Database");
//Query Database and add a row into the TEST table.
$addrow = "INSERT INTO test VALUES ('$name1', '$name2')";
$result= mysql_query($addrow, $connection) or die("Can't Add Selections to Test Table");
$row = mysql_fetch_array($result);
echo($row["name1"] . " " . $row["name2"]);
The variables "name1" and "name2 are submitted from a form. Running a script with containing this code, I get the following error:
Warning: MySQL: Unable to save result set in /home/httpd/web/new/dbtest.php3 on line 35
Can't Add Selections to Test Table
Note: Line 35 is the line containing the query. Also, if I remove the "die" function, I get an additional error on the mysql_fetch_array line. This seems to indicate that the $result variable returned false. As mentioned above, the row is actually added to the database. This also does not work if I use mysql_db_query instead of mysql_query.
Any help would greatly be appreciated.
--Alan Flum
Celestial Graphics Inc.