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>

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.