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? Link to comment https://forums.phpfreaks.com/topic/276052-mysql_result-error/ 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 '. Link to comment https://forums.phpfreaks.com/topic/276052-mysql_result-error/#findComment-1420533 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.