c_shelswell Posted February 8, 2007 Share Posted February 8, 2007 I'm really confused this i have a function that's been working fine for ages and now seems to have stopped! It works fine still on my dev box PHP 4 but on uploading it to my server (php 5) now spits out: "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource" Bit confused why it'd work in one place not in the other. The function's looking for a banned username the username i'm trying to register i know isn't so there shouldn't be any results here's the code: function usernameBanned($username){ if(!get_magic_quotes_gpc()){ $username = addslashes($username); } $q = "SELECT username FROM ".TBL_BANNED_USERS." WHERE username = '$username'"; $result = mysql_query($q, $this->connection); return (mysql_num_rows($result) > 0); } thanks for any help Link to comment https://forums.phpfreaks.com/topic/37600-mysql_num_rows/ Share on other sites More sharing options...
JasonLewis Posted February 8, 2007 Share Posted February 8, 2007 change this: $result = mysql_query($q, $this->connection); to this: $result = mysql_query($q, $this->connection) or die("Error: ".mysql_error()."<br>SQL: ".$q); Link to comment https://forums.phpfreaks.com/topic/37600-mysql_num_rows/#findComment-179770 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.