1 / 10

ColdFusion :

ColdFusion :. Code for front page. <cfquery datasource="mydb" name="customers"> select custnumb, custname from customer </cfquery> <html> <title>Customer list</title> </head> <body> <center> <table border> <tr> <th colspan=2> <h1>Customers</h1>

spence
Download Presentation

ColdFusion :

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ColdFusion :

  2. Code for front page <cfquery datasource="mydb" name="customers"> select custnumb, custname from customer </cfquery> <html> <title>Customer list</title> </head> <body> <center> <table border> <tr> <th colspan=2> <h1>Customers</h1> </tr>

  3. Front page contd. <tr> <th> Name</th> <cfoutput query="customers"> <tr> <td>#custname#</td> <td><A HREF="custupdatefront.cfm?custnumb=#custnumb#">Edit</A> <A HREF="custdelete.cfm?custnumb=#custnumb#">Delete</A> </td> </tr> </cfoutput> <tr> <th colspan=3> <A HREF="custaddfront1.cfm?custnumb=#custnumb#">Add a customer</A> </th> </tr> </table> </center> </body> </html>

  4. Code for updating a customer record <CFIF ParameterExists(Custnumb) IS "NO"> Error! No Customer number was specified! <CFABORT> </CFIF> <CFQUERY datasource = "mydb" name="customers"> select custname, address, balance, credlim, slsrnumb from customer where custnumb=#custnumb# </cfquery> <cfoutput query="customers"> <html> <head> <title>Update customer #Custname#</title> </head> <body> <H1>Update customer #Custname#</H1> <form action="custupdate.cfm" method="POST"> <input type="hiden" name="custnumb" value="#custnumb#"> <br>

  5. Code for update contd. Name: <input type="text" name="custname" size="15" value="#custname#"> <br> Address: <input type="text" name="address" size="25" value="#address#"> <br> Balance: <input type="text" name="balance" size="10" value="#numberformat(balance, "9999.99")#"> <br> Credit limit: <input type="text" name="credlim" size="10" value="#numberformat(credlim, "9999.99")#"> <br> Sales rep number: <input type="text" name="slsrnumb" size="5" value="#numberformat(slsrnumb, 9)#"> <P> <input type="submit" value="Update Customer"> <input type="reset" value="Clear"> </form> </body> </html> </cfoutput>

  6. Update code: template# 2 <cfquery datasource="mydb"> update customer set custname='#custname#', address='#address#', balance=#balance#, credlim=#credlim#, slsrnumb=#slsrnumb# where custnumb=#custnumb# </cfquery> <cfoutput> <html> <head> <title>Customer #custname# updated</title> </head> <body> <h1>Customer #custname# has been updated</h1> /body> </html> </cfoutput>

  7. Code for delete cont. <cfquery datasource="mydb"> delete from customer where custnumb=#custnumb# </cfquery> <html> <head> <title>Employee deleted</title> </head> <body> <cfoutput> <h1>Customer #custnumb# deleted</h1> </cfoutput> </body> </html>

More Related