I've been working on a custom component, and it's been a lot of fun learning all about Joomla!'s API and generally making things happen. But today I hit a snag I'm not sure how to get around.
In my component, when a user answers a question correctly, I want to increment the value of a field in the DB. I'm using the following code:
Code: Select all
$database->setQuery("UPDATE table SET num_correct_answers = num_correct_answers + 1 WHERE quiz_id = $qid");
$result = $database -> loadObjectList();
if ($database -> getErrorNum()) {
echo $database -> stderr();
return false;
}
And while this appears to be working (the value is being increased every time), Joomla! is giving me a couple warning messages from database.php.
Is this because I'm doing something wrong, or because there is an incompatibility with this statement and what database.php expects? Your wisdom is greatly appreciated.Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in [path]/includes/database.php on line 489
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in [path]/includes/database.php on line 496
Running Joomla! 1.0.12
PHP 4 and MySQL 5
M