wescrock Posted September 4, 2008 Share Posted September 4, 2008 Hi all. I am very VERY new to PHP... and my first task is creating a way to update a single table. As of now, the table contains ALL the data in the DB... but that is because someone at the Smithsonian has no idea what they were doing. I have the first page as just a query of data. All data in the table is shown... If a user clicks on the user id, it goes to an form page that pulls in all the info for editing... then when you hit submit, it says that the table was suscessfully updated... but no change was made. here is the code to my execute_update.php file: <?php include '../db.inc'; $dbh = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $id=$_POST['id']; $citation=$_POST['citation']; $annotation=$_POST['annotation']; $format=$_POST['format']; $categories=$_POST['categories']; $subcategories=$_POST['subcategories']; $fair_year=$_POST['fair_year']; $link=$_POST['link']; $publish_live=$_POST['publish_live']; $owner=$_POST['owner']; $country=$_POST['country']; $state=$_POST['state']; $city=$_POST['city']; $topic=$_POST['topic']; $fairyear=$_POST['fairyear']; $sort=$_POST['sort']; mysql_query(" UPDATE wfbiblio SET citation='$citation' ,annotation='$annotation' ,format='$format' ,categories='$categories' ,subcategories='$subcategories' ,fair_year='$fair_year' ,link='$link' ,publish_live='$publish_live' ,owner='$owner' ,country='$owner' ,country='$owner' ,state='$state' ,topic='$topic' ,fairyear='$fairyear' ,sort='$sort' WHERE id='$id'"); echo "Record Updated"; ?> Thanks everyone. And I am sure that I will be using this great forum a bunch!. -Wes Link to comment https://forums.phpfreaks.com/topic/122722-solved-php-update-query/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.