EasyCFM.COM ColdFusion Forums / Tutorial Requests! / CFC functions and MySQL add/edit/deletes

   Reply to Discussion | New Discussion next >> 
Posted By Discussion Topic: CFC functions and MySQL add/edit/deletes

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

Cheesecake87
08-28-2013 @ 9:55 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 28
Joined: May 2010

I just started learning about the old CFC dragon and all its wonders.

Now I understand how to follow the code on the CFC pages, with the functions and arguments.

Although there is one thing my cflocation brain just can't come to terms with. So after the CFC function has been called... bla bla, where does the page go?

I understand that simple cfml pages call the function then the return value from the component is returned to the page that called it, that is simple enough.

But, what if you wanted to create a function that controls the add, edit and deletion of records on a single table.

How I would normally do this is say: formPage.cfml (data)> add / edit / deletePage.cfml (cflocation, url confirm data)> formPage.cfml(with message generated by cfif looking for url confirm data), the very linear step by step way that I know.

So how is this process done within a CFC function? I have already had a look at a few tutorials on CFCs ( http://tutorial348.easycfm.com/ ) but none detail how to update SQL, or update then go to another page, or show confirmation of the action.

I suppose the simple way of explaining it would be like a save button on a form. So you click to add new item it would then take you to a form, then you input yor data and click save, this would then save the data then take you back to the inventory list using cflocation.

Now the way I see CFCs is that the function would have to be called. So you click to add new item, then save, it calls the function then adds the data to the table, the function is set to return confirmation and the form page uses the returned confirmation to show the message... OK I just figured out how it works.

But a tutorial on working with CFCs and MySQL would be nice, detailing the steps and getting confirmation or handling errors.


Website Designed and Developed by Pablo Varando.