Updating rows in a mysql table
Posted: Sat Jan 19, 2013 2:30 am
Hey I im trying to udpate the rows PassWord, email, Age in my membersys table of my mysql database. With the code im using its only saving the age and nothing else.
Also the the new info is coming from a form using the POST method
Any Ideas?
Also the the new info is coming from a form using the POST method
Code: Select all
<?php
session_start();
$con = mysql_connect("localhost","MyUser","MySecretPass");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("membersys", $con);
$ui = $_POST['username'];
$pi = $_POST['password'];
$ei = $_POST['email'];
$ag = $_POST['age'];
$user = $_SESSION['UserName'];
mysql_query("UPDATE Member SET PassWord=$ui WHERE UserName='$user'");
mysql_query("UPDATE Member SET email=$ei WHERE UserName='$user'");
mysql_query("UPDATE Member SET Age=$ag WHERE UserName='$user'");
Header("Location: acc_content.php?account=updated");
mysql_close($con);
?>