otuatail Posted August 26, 2009 Share Posted August 26, 2009 Hi I am finding this a bit confusing as it should be valid. <? include ("../MalawiFunctions.inc"); $page = "Topic"; session_start(); connectDB(3); $USR = $_POST['User']; $PWD = $_POST['pwd']; $sql = "SELECT * FROM Accounts WHERE USR = '" . $USR . "' AND PWD = '" . $PWD . "'"; $query = mysql_query($sql); // or die(mysql_error()); $Rows = mysql_num_rows($query); ?> I get Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/fhlinux190/d/des-otoole.co.uk/user/htdocs/cms/admin/Validate.php on line 11 11 = $Rows = mysql_num_rows($query); but this should be valid Quote Link to comment Share on other sites More sharing options...
asmith Posted August 26, 2009 Share Posted August 26, 2009 Change this line: $query = mysql_query($sql); // or die(mysql_error()); to this: $query = mysql_query($sql) or die(mysql_error()); To see what is wrong with the query that it is not acting fine for the num_rows. Everytime if you see your num_rows gives you such error, Check your query. Quote Link to comment Share on other sites More sharing options...
otuatail Posted August 26, 2009 Author Share Posted August 26, 2009 Good point never assume the query is correct. Thanks. Quote Link to comment 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.