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 Link to comment https://forums.phpfreaks.com/topic/171941-solved-mysql_num_rows-argument-is-not-valid/ 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. Link to comment https://forums.phpfreaks.com/topic/171941-solved-mysql_num_rows-argument-is-not-valid/#findComment-906626 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. Link to comment https://forums.phpfreaks.com/topic/171941-solved-mysql_num_rows-argument-is-not-valid/#findComment-906638 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.