tags:

views:

35

answers:

2
A: 

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
+2  A: 

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.

Eric
YOu would seen the code ,i used to insert.Now,if there are n records ,i need to select one column and edit the data and put back them in to db.Plz give me a snippet
DAFFODIL
If you're changing all of the columns to the same value, you could run "UPDATE customers SET fieldname = newvalue". If you need to edit each one individually, as far as I know you'll have to run a separate query for each record.
Eric
okay,this works.
DAFFODIL