Manage Records with Validation Class |
[eluser]section31[/eluser]
Are there any examples or open source scripts that show an extremely clean way to manage records using the validation class. Essentially what the scaffolding does, but writing it yourself manually. When I say clean, I mean proper and efficient I guess. So, an example of adding, editing, and deleting a list of records.
[eluser]imzyos[/eluser]
yep, not all functions of validation class, but a little example http://www.michaelwales.com/2007/10/drun...t-us-form/
[eluser]section31[/eluser]
Thanks for the reply but this is essentially the stuff that's on the user guide. I wanted a sample CRUD Script. CRUD = Create, Read, Update, Delete Records Script. I'm actually going to make one and post it, just to see if people can help me clean it up. NOTE: I've only been using CI for a couple of days...still very new. I've just been browsing the thousands of lines of code, reading through the documentation, and just messing around. Haven't actually created a site or full script yet.
[eluser]imzyos[/eluser]
Code: <?php simple and maybe a little basic or some parts could be better but like an example are nice ^^
[eluser]Majd Taby[/eluser]
section31, check out CodeExtinguisher (link in my signature), it's perfect for what you want. also watch http://codeextinguisher.com/screencasts/..._codex.mov The only thing is, the version you see in the video isn't released yet, should be released in a few weeks though.
[eluser]imzyos[/eluser]
yeah, CE rocks, but he want the 'clasic way' i guess :S
[eluser]section31[/eluser]
hm, i didn't get any notification that someone had replied to this thread...sorry guys... I haven't looked at code extinguisher yet, but I will. I came up with the following as a sample CRUD. Can someone be so kind and look through the source and see if it's ok. http://code9.info/codeigniter/index.php/records I modified the validation class a tad because it needs it. I added a public property for the class called $_fields_keys which is used for building our validated fields array for pushing into our database and clearing our fields once a form has been submitted successfully. clear_fields is a much needed method that clears all validated properties in case you want to display the form without the fields. It's used once the form is submitted and a record has been added successfully. get_fields is also a much needed method that grabs all validated fields into an array so you can prep your array for either inserting or updated the record in your database. Code: function clear_fields() { |
Welcome Guest, Not a member yet? Register Sign In |