Minase Posted February 21, 2009 Share Posted February 21, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/146202-solved-little-help/ Share on other sites More sharing options...
MasterACE14 Posted February 21, 2009 Share Posted February 21, 2009 I don't think you can call your function 'count' as that is already taken. Quote Link to comment https://forums.phpfreaks.com/topic/146202-solved-little-help/#findComment-767565 Share on other sites More sharing options...
Minase Posted February 21, 2009 Author Share Posted February 21, 2009 it does not matter the name,it was just informative,the problem is that even the simple querys are not working Quote Link to comment https://forums.phpfreaks.com/topic/146202-solved-little-help/#findComment-767566 Share on other sites More sharing options...
Philip Posted February 21, 2009 Share Posted February 21, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/146202-solved-little-help/#findComment-767568 Share on other sites More sharing options...
Minase Posted February 21, 2009 Author Share Posted February 21, 2009 oh baka me thank you solved the problem Quote Link to comment https://forums.phpfreaks.com/topic/146202-solved-little-help/#findComment-767581 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.