Jump to content

mysql_num_rows Problem: PHP or MySQL Error?


kingnutter

Recommended Posts

Hi there,

 

I am trying to JOIN two databases and retrieve the number of rows. I keep getting the error message:

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\web\mojo\php-files\edit_mojo_cd.php on line 453

 

Could anyone give the code below a short scan at let me know if the problem might be the MySQL query or the mysql_num_rows line. Or both?

 

Thanks.

KN

 

foreach ($missing_genres as $row)
{
$query="SELECT * FROM genrelinkcd WHERE genrelinkcd.genre_id=genres.genre_id WHERE genres.moj_genre='$row'";

$result = mysql_query($query);
$amount = mysql_num_rows($result);
...

Link to comment
Share on other sites

Hi,

Your query is wrong - you have 2 WHERE statements in there.

$query="SELECT * FROM genrelinkcd WHERE genrelinkcd.genre_id=genres.genre_id WHERE genres.moj_genre='$row'";

I can't quite work out what you are trying to do with that query so I can't actually suggest what it should lool like.

 

Chris

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.