Update records in database

 This will update data in the database.

The first query adds the record 'Tom Jackson' to the database.

<cfset First_Name = "Tom">

<cfset Last_Name = "Jackson">

<cfquery name="add_person" datasource="persondb" username="" password="">

INSERT INTO person

(Person_First_Name,

Person_Last_Name)

VALUES

('#First_Name#',

'#Last_Name#')

</cfquery>

This query look for all records where 'Person_First_Name' is Tom, and update those records to 'Person_First_Name' is 'Jim' using the WHERE statement.

<cfquery name="add_person" datasource="persondb" username="" password="">

UPDATE person

SET Person_First_Name = 'Jim'

WHERE

Person_First_Name = 'Tom'

</cfquery>

Advertisement

Hot Offer

No User Comments.

No User Comments, be the first one to write your comments?

ApplayIT is owned by Scandic Systems LTD [UK] Company No. 5984000. All other trademarks and copyrights are the property of their respective holders.