Use a UPDATE query in pace of the INSERT.
Something like:
$sql="UPDATE Customer SET Name = $new_name WHERE....";
Rest of the code remains same.
codaddict
2010-04-02 06:55:17
Use a UPDATE query in pace of the INSERT.
Something like:
$sql="UPDATE Customer SET Name = $new_name WHERE....";
Rest of the code remains same.
A SQL update query looks like this:
UPDATE customers SET fieldname = newvalue WHERE id = '$id'
Complete syntax guide is at http://dev.mysql.com/doc/refman/5.0/en/update.html.
Also, you might want to have a look at filtering any user input before sending it the database. Using mysql_real_escape_string() is pretty much a necessity for security reasons.