Need Help as to why I am getting an error using mysql_fetch
Posted: Sun Sep 21, 2008 3:26 pm
Hey There,
I am trying to retrieve a username from my database and I keep getting this error.
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
Here is the simple code.
$reg_pass = $_POST['reg_pass'];
$reg_email = $_POST['reg_email'];
$result = " SELECT * FROM login WHERE reg_email='$reg_email' AND reg_pass='$reg_pass' ";
if (!$result) {
echo mysql_error();
exit;
}
while($row = mysql_fetch_array($result) )
{
echo $row['reg_firstname'];
}
Please help as this is driving me crazy. The error is coming from the myswl_fetch_array line.
I am trying to retrieve a username from my database and I keep getting this error.
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
Here is the simple code.
$reg_pass = $_POST['reg_pass'];
$reg_email = $_POST['reg_email'];
$result = " SELECT * FROM login WHERE reg_email='$reg_email' AND reg_pass='$reg_pass' ";
if (!$result) {
echo mysql_error();
exit;
}
while($row = mysql_fetch_array($result) )
{
echo $row['reg_firstname'];
}
Please help as this is driving me crazy. The error is coming from the myswl_fetch_array line.