RE: [PHP] Update to DB

From: Date: Wed, 28 May 2003 12:33:43 +0000
Subject: RE: [PHP] Update to DB
Groups: php.general 
Request: Send a blank email to php-general+get-149234@lists.php.net to get a copy of this message
[snip] I was just wondering how to update data to database from html text field. Anyone know what is the proper way to do this? [/snip] The action for your form can contain an SQL UPDATE statement where the values in the database are updated with the values in the form. Fairly simple. Here is an example from some of my code on a project... //update tables for each set $qup = "UPDATE tblClassOthers "; $qup .= "SET BilledFlag = '" . date("Y-m-d") . "', "; $qup .= "CycleFlag = '" . $emicycle . "' "; $qup .= "WHERE RecordDate <= '" . $emidate . "' "; $qup .= "AND RecordID = '010101' "; $qup .= "AND BilledFlag = '' "; if(!($dbup = mysql_query($qup, $dbconnect))){ print("MySQL reports: " . mysql_error() . "\n"); exit(); } HTH! Jay

« previous php.general (#149234) next »