Mysql query problems (very confused)
Posted: Sun Jun 11, 2006 7:45 pm
Hi, i have been working with MySQL for a while now and made many database driven sites and always been able to fix any problems but this one is really bugging me.
I have a simple block of code that when working correctly should change an enabled value in a table to 0 but the query is not working. Here is the code:
SQLValue() is a function that i use on all the querys that makes sure eveything going into a database is valid. the "int" part tells it its an integer so it checks it is ok, the 0 does not go through this check as the function would return NULL, which is not what i wanted. Anyway when i run this nothing happens, so i added this part afterwards to debug:
which returns:
i have fun the query in phpMyAdmin and it works fine. i have even just put a simple "SELECT * FROM users" (another table that gets called before and works fine) in the mysql_query() function and i still get the same errors. I have tried changing all the variables, still same problem. I think that is the bulk of the info, if anything else is needed please ask.
Hope you can help many thanks
Richard
I have a simple block of code that when working correctly should change an enabled value in a table to 0 but the query is not working. Here is the code:
Code: Select all
$find_pic_cat = sprintf("UPDATE pics_categories SET enabled=0 WHERE id=%s",
SQLValue($_POST['catid'],"int"));
$query_pic_cat = mysql_query($find_pic_cat);Code: Select all
echo $find_pic_cat ."<br />".mysql_error($query_pic_cat)."<br />". mysql_info($query_pic_cat)."<br />".$_POST['catid'];Code: Select all
Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /home/bfp/public_html/class2005/user.php on line 361
Warning: mysql_info() expects parameter 1 to be resource, boolean given in /home/bfp/public_html/class2005/user.php on line 361
UPDATE pics_categories SET enabled=0 WHERE id=85
85Hope you can help many thanks
Richard