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;

?>

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'";

Thanks man, i really appreciate it.

Works great. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.