Jump to content

This code worked last week, now error from MySQL


bradymills

Recommended Posts

I'm not sure what happened, but this code was working for about a month, and now it doesn't. I'm getting the error -- MySQL num_rows not valid argument. Can anyone see why this isn't working? It worked, and now it doesn't. I don't understand.

 

	$query = "SELECT photo, CONCAT(first_name, ' ', last_name) AS name, review_text, review_date, reviewerate_rate FROM wng_reviewers, reviews, reviewerate WHERE reviews.prod_id=$id AND wng_reviewers.user_id=reviews.user_id AND reviewerate.user_id=wng_reviewers.user_id AND reviewerate.prod_id=$id ORDER BY review_date DESC";
$result = mysql_query ($query);
$num = mysql_num_rows($result);
if ($num > 0) { //If it ran OK, display the records.

echo '<table width="90%" cellspacing="0" cellpadding="3" align="center">';

while ($row = mysql_fetch_array
($result, MYSQL_ASSOC)) {

echo '<tr>
		<td width="50" style="padding-right: 10px;"><img src="reviewerspanel/uploads/'.$row['photo'].'" width="50" /></td>
		<td><span style="font-size: 10px; font-weight: bold;">'.$row['name'].' gave this item a '.$row['reviewerate_rate'] . ' and said:</span><br/>
		'.$row['review_text'].'
		</tr>
		<tr><td> </td></tr>
	';
}//End of while loop
echo'</table>';
}//End of query.
echo'
		</td>
	<!--End reviews pull-->
	</td>
</tr>
</table>

Well, here's an update. I added portions of my select statement and tested, little by little. Seems the ORDER BY clause was throwing everything out of whack. This worked about a week ago, perfectly. So, temporarily, I have removed the ORDER BY and it seems to work fine. Of course, now it's not in the order I'd like. Any ideas?

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.