[SOLVED] UPDATE Query
Posted: Wed Aug 11, 2004 12:06 am
Hi. I asked about this some time ago, and i still cannot get it to work.
Here is the code:
It says Changes made successfully, but the changes arent made. Can anyone help?
Here is the code:
Code: Select all
} else if ($action=='cpcadf') {
if (is_null($suser)) {
echo "You are not logged in.";
} else {
$user = $_POST["user"];
$pass = $_POST["pass"];
$nname = $_POST["nname"];
$email = $_POST["email"];
$link = mysql_connect("localhost", "root", "")
or die("Could not connect");
mysql_select_db("stormst_sspp")
or exit("Could not select database");
$mpass=MD5($pass);
$result=mysql_query("select id,user,pass from sspp WHERE user='$user' and pass='$mpass'");
if (mysql_num_rows($result)==0) {
echo "Error: Incorrect username/password.";
} else {
list($id) = mysql_fetch_row($result);
$query = "UPDATE sspp SET nname='$nname' AND email='$email' WHERE id='$id'";
if(mysql_query($query))
{
echo "Changes made successfully.";
}
else
{
echo "Changes could not be carried out.";
}
}
mysql_close($link);
}
}