PHP Error Warning: mysql_num_rows(): supplied argument is not a valid MySQL

  • Thread starter Thread starter Hank B
  • Start date Start date
H

Hank B

Guest
result resource in ...? I have this code:
-------------------------
include 'files/config.php';
$uid = $_POST['uid'];
$pass = md5($_POST['pass']);
$mysql['query'] = mysql_query('SELECT username, password FROM adminusers WHERE username=' . $uid . ' AND password=' . $password);
if (mysql_num_rows($mysql['query']) != 0) { \ <---- Line 27
echo "<p>Successfull!</p>";
} else {
echo "<p>Invalid Username or Password</p>";
}
---------------------
(here is the "files/config.php" file:)
---------------------
<?php
$dbhost = "localhost";
$dbuser = "XXXXXXX";
$dbpass = "XXXXXXXX";
$con = mysql_connect($dbhost,$dbuser,$dbpass);
$db = mysql_select_db('XXXXXXX',$con);
?>
-------------------
and I get this error:
--------------------
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in ... on line 27
--------------------
So how can I make it get a username and password from the DB and use mysql_num_rows to see if it exists in the table
$mysql['query'] = mysql_query('SELECT username, password FROM adminusers WHERE username=' . $uid . ' AND password=' . $password, $con);

does not work either
 
Back
Top