Jump to content

mysql_result error


Croatiangrn

Recommended Posts

<?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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.