Croatiangrn Posted March 23, 2013 Share Posted March 23, 2013 <?php function item_Exists($table, $item) { $table = mysql_real_escape_string($table); $item = (int)$item; $query = mysql_query("SELECT COUNT(id) FROM '$table' WHERE 'id' = $item"); return (mysql_result($query, 0) == 1) ? true : false; } function rate($table, $item, $rating) { $table = mysql_real_escape_string($table); $item = (int)$item; $rating = (int)$rating; mysql_query("UPDATE '$table' SET 'ukupno_glasova' = 'ukupno_glasova' + $rating, 'glasanje' = 'glasanje' + 1 WHERE 'id' = $item"); } ?> so this is my code, and when i start this script it gives me error : "Warning: mysql_result() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\glasanje\core\func\rating.php on line 9" help? Quote Link to comment Share on other sites More sharing options...
fenway Posted March 23, 2013 Share Posted March 23, 2013 That's what mysql_error() is for. But the real issue is that you're confusing backticks and quotes -- ` is not the same as '. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.