0

Can someone tell me why this would cause the following error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource

<?php
$un = $_POST;
$pw = $_POST;

include("../admin/mysql.php");
$query = "select * from tbl_accounts WHERE $un = email AND $pw = password";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$userpass = $row;

echo $userpass;

?>

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by Morty222
0

You have the WHERE clauses reversed

$query = "select * from tbl_accounts WHERE $un = email AND $pw = password";

Should be

$query = "select * from tbl_accounts WHERE email = '$un' AND password = '$pw'";
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.