ColdFusion - Update database data using cfquery

cfquery - update data

cfqueryUpdate.cfm


<!DOCTYPE html">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfquery tag example: how to update data</title>
</head>

<body>
<h2 style="color:hotpink">cfquery example: data update</h2>

<cfquery name="qAuthors" datasource="cfbookclub">
 SELECT AuthorID, LastName, FirstName FROM AUTHORS
    WHERE AuthorID=14
</cfquery>
<cfdump var="#qAuthors#">

<cfquery name="qAuthorsUpdate" datasource="cfbookclub" result="AuthorUpdate">
 UPDATE AUTHORS SET LastName='Forta', FirstName='Ben'
    WHERE AuthorID=14
</cfquery>
<cfdump var="#AuthorUpdate#">

<cfquery name="qAuthors" datasource="cfbookclub">
 SELECT AuthorID, LastName, FirstName FROM AUTHORS
    WHERE AuthorID=14
</cfquery>
<cfdump var="#qAuthors#">

</body>
</html>





More ColdFusion examples