Hi guys I am trying hard to rewrite my site as I have had problems with the original I have written a script to enter a users information into a mysql table which works fine. I am now trying to get the edit information page working but have come across this error
Supplied argument is not a valid MySQL result resource on line 6
the code is below can anyone tell me what is wrong with it?
<?php
include "inc.php";
if (empty($page)) $page = "";
if ($page == login) {
$result = mysql_query("SELECT user, password FROM info WHERE user = '$username'");
while ($i = mysql_fetch_array($result)) {
if ($password == $i[password]) {
Setcookie($username, $password);
Header("Location: $url/members/index.php?username=$username");
}
}
} else {
include "admin/head.php";
?>
<form action=login.php?page=login method=post>
<table border=1 cellpadding=1 cellspacing=0>
<tr><td><font face=arial size=2>Username: </font></td><td><input type=text name=username></td></tr>
<tr><td><font face=arial size=2>Password: </font></td><td><input type=password name=password></td></tr>
<tr><td colspan=2><input type=submit value="Change Info"></td></tr>
</table>
</form>
<?php
}
echo "<br><center><br>";
include "admin/foot.php";
?>
thanks I just dont know what I am doing wrong!
Aaron