hey guys..
I am pretty new with mysql and I cant figure out why this won't work for the life of me.. i am trying to do an update profile thing, info is passed from a form on one page to the php script that executes the actual updating..
it says that it works but when i check the database nothing has been changed. here is the live example of what happens..
the php script that tries to update it is this:
if ($HTTP_POST_VARS['password']== $HTTP_POST_VARS['password2']){
if (strstr($HTTP_POST_VARS['email'], "@"
and strstr($HTTP_POST_VARS['email'], "."
){
$error=false;
$username=$_SESSION['username'];
$password=$HTTP_POST_VARS['password'];
$first=$HTTP_POST_VARS['first'];
$last=$HTTP_POST_VARS['last'];
$email=$HTTP_POST_VARS['email'];
$quote=$HTTP_POST_VARS['quote'];
$connection = mysql_connect("blah","blah","blah"
;
$db=mysql_select_db("blah",$connection);
$sql = "UPDATE users SET Login='$username', Password='$password', First='$first', Last='$last', Email='$email', Quote='$quote' WHERE id='$id'";
if(!mysql_query($sql, $connection)){
echo "failed";
}else{
echo "updated";
//header("Location: ".$_SESSION['return']);
//exit;
}
}else {
$error ="Invalid email address!";
}
}else{
$error ="Passwords do not match!";
}
I know my script is probably pretty weak, but I am new to both php and mysql
thanks in advance
//jason
I am pretty new with mysql and I cant figure out why this won't work for the life of me.. i am trying to do an update profile thing, info is passed from a form on one page to the php script that executes the actual updating..
it says that it works but when i check the database nothing has been changed. here is the live example of what happens..
the php script that tries to update it is this:
if ($HTTP_POST_VARS['password']== $HTTP_POST_VARS['password2']){
if (strstr($HTTP_POST_VARS['email'], "@"
$error=false;
$username=$_SESSION['username'];
$password=$HTTP_POST_VARS['password'];
$first=$HTTP_POST_VARS['first'];
$last=$HTTP_POST_VARS['last'];
$email=$HTTP_POST_VARS['email'];
$quote=$HTTP_POST_VARS['quote'];
$connection = mysql_connect("blah","blah","blah"
$db=mysql_select_db("blah",$connection);
$sql = "UPDATE users SET Login='$username', Password='$password', First='$first', Last='$last', Email='$email', Quote='$quote' WHERE id='$id'";
if(!mysql_query($sql, $connection)){
echo "failed";
}else{
echo "updated";
//header("Location: ".$_SESSION['return']);
//exit;
}
}else {
$error ="Invalid email address!";
}
}else{
$error ="Passwords do not match!";
}
I know my script is probably pretty weak, but I am new to both php and mysql
thanks in advance
//jason