PHP: 4.0.4pl1
MySQL: 3.23.36-1
I have the following code fragment, which uses the same connection
parameters elsewhere to *successfully* to retrieve data from a database,
so this doesn't appear to be a permissions problem with MySQL.
However, nothing happens with inserts; no rows are added at all. All I get
is a message form mysql_error() saying "Query was empty."
Can anyone tell me what might be wrong?
$user_idx = 1;
$objective = 1;
$question = 'Foo';
$question_type = 'singular';
$connection_id = mysql_connect ('192.168.1.1', 'php', 'password')
or die ("No connection.\n");
$sql = "INSERT INTO question VALUES (NULL, $user_idx, $objective,
'$question', '$question_type', NULL, NULL)";
$result = mysql_db_query('item_db', $sql_query, $connection_id);
echo "<pre>";
echo "\nDebugging output:\n";
echo "\tSQL: $sql\n";
echo "\tError: ", mysql_error(), "\n";
echo "\tLast insert ID: ", mysql_insert_id(), "\n";
echo "\tResult: $result\n";
echo "</pre>\n";
--
Todd A. Jacobs
CodeGnome Consulting, LTD