0

Sorry I think I posted it on the Wrong Forum, Please Delete this Post... :(

$result = mysql_query("
SELECT q.*, IF(v.id,1,0) AS voted
FROM quotes AS q
LEFT JOIN quotes_votes AS v 
ON 	q.id = v.qid
	AND v.ip =".$ip."
	AND v.date_submit = '".$today."'
");

$i=1;
$str='';
$script='';

while($row=mysql_fetch_assoc($result))
{
	// Looping through all the quotes and generating the list on the right of the page:
	
	$str.= '<div class="thumb" id="q-'.$i.'">'.substr($row['txt'],0,20).
	'<span class="points">...</span><div class="star-rating" id="rating-'.$i.'">';
	
	$row['rating'] = round($row['rating']);
	for($z=0;$z<5;$z++)
	{
		$str.='<input type="radio" name="rate-'.$i.'" value="'.($z+1).'" '.($z+1==$row['rating']?'checked="checked"':'').' disabled="disabled" />';
	}

	$str.='</div></div>';
	
	// Each quote calls the fillData JS function
	$script.="fillData(".formatJSON($row).");".PHP_EOL;
	
	$i++;
}

This is a Code for Quotation Script where User can Vote for the Quotation and Stuff..
But whenever I run this I encounter this Error:-

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /public_html/index.php on line 31

Please Help! Thank You! :D

Edited by as005: n/a

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by urtrivedi
1

>> Sorry I think I posted it on the Wrong Forum, Please Delete this Post.

It'll get moved in a short while. Be patient :)

Votes + Comments
Moved!
0

I already Posted it here, In PHP :P Please Delete this :D

0

There is problem with your query.
before executing it do following.

$query="SELECT q.*, IF(v.id,1,0) AS votedFROM quotes AS qLEFT JOIN quotes_votes AS v ON 	q.id = v.qid	AND v.ip =".$ip."	AND v.date_submit = '".$today."'";

echo $query;
.
.
.
$result = mysql_query($query);
.
.
.

copy the output of query, run it in phpmyadmin and check the query syntax properly there.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.