Jump to content

Recommended Posts

hy there lets say that i have a code that is "problematic"

here it is

$q = "SELECT * FROM `users` WHERE `Username` = 'Minase' ";
$test =  mysql_query ($q);
$test2 = mysql_num_rows($test);

this is not the real code,i did split the code maybe it was something weird about it,but it isnt.

the problem is that it return

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in LOCATION

 

my real code

function count ( $query )
	{
		return mysql_num_rows ( mysql_query ( $query ) );
	}

 

any idea why it return that error?  thank you

Link to comment
https://forums.phpfreaks.com/topic/146202-solved-little-help/
Share on other sites

function count ( $query ) {
        $q = mysql_query ( $query ) or die(mysql_error());
return mysql_num_rows ( $q );
}

 

I would imagine it's because you cant connect to the db. But lets see what it dies.

 

Oh and as mentioned, be careful using the same function names.

Link to comment
https://forums.phpfreaks.com/topic/146202-solved-little-help/#findComment-767568
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.