PHP UPDATE code
Posted: Sat Feb 07, 2009 10:02 pm
Hey I'm new to PHP and MySQL, and I've looked over a few codes for UPDATE, but no matter what I change my code to, it just will NOT work. I will post my code below. Any suggestions would be EXTREMELY appreciated! Thanks!
Code: Select all
<?php
$con = mysql_connect("localhost","Website","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("website", $con);
mysql_query("UPDATE users u SET u.Password = 'Password', u.First_Name = 'First_Name', u.Middle_Initial = 'Middle_Initial', u.Last_Name = 'Last_Name', u.Street_Address = 'Street_Address', u.City_Town = 'City_Town', u.Province = 'Province', u.Postal_Zip = 'Postal_Zip', u.Activities = 'Activities', u.Animals_Pets = 'Animals_Pets', u.Cars = 'Cars', u.Movies = 'Movies', u.Music = 'Music', u.Outdoor = 'Outdoor', u.Sports = 'Sports', u.Video_Games = 'Video_Games'
WHERE User_Id = '$_SESSION['Email1']'");
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record updated";
mysql_close($con);
?>