Jump to content

[SOLVED] little help


Minase

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

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.