[solved] Get data from MySQL in form, validate new values and update MySQL |
[eluser]Jan_1[/eluser]
So I've read and understand the User Guide 'Form Validation' and 'Database Class'. I do get datas out of my database, but how do I have to handle it, if I want to write old data into the form-fields and let them update by user? Found lot's of hints, but don't get them together. Is there any good manual, which I didn't found? Thank you! Jan
[eluser]TheFuzzy0ne[/eluser]
You can give a default value as a second parameter to set_value(). If validation hasn't run, that default value will be shown.
[eluser]pistolPete[/eluser]
Have a look at this thread: http://ellislab.com/forums/viewreply/533725/
[eluser]Jan_1[/eluser]
Thank you, both. Incredible fast answers. Second parameter in set_value() seemed to me as the faster way for the moment. What about the Update-Statement. I have tryed with Code: $data = array(
[eluser]pistolPete[/eluser]
Please be more precise, "It did’nt work." is not a good error description! Did you get an error message? Where do you put that code, where is that "wrong place" ?
[eluser]Jan_1[/eluser]
So, this is how I've 'succesfully' done it: I wrote 3 functions with sql-queries in my MODEL Quote: a) select_data I've used 3 functions in my CONTROLLER to edit data from database. Quote: 1. function get_data()If that works it might be useful to extend it with a second View (Do you really want to do this") or something similar. |
Welcome Guest, Not a member yet? Register Sign In |