![]() |
A little help with my first app... - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: A little help with my first app... (/showthread.php?tid=27718) Pages:
1
2
|
A little help with my first app... - El Forum - 02-18-2010 [eluser]invision[/eluser] I call it an app, but it's just going to be a basic guestbook ![]() I'm hoping to retrieve records from my 'data' table in MySQL and ultimately display them in my view. I've stumbled at the first hurdle though ![]() Controller(guestbook.php): Code: <?php Model(guestbook.php): Code: <?php My error message is: Code: A PHP Error was encountered Many thanks for any pointers with this. Hopefully I shouldn't have to come back too often. A little help with my first app... - El Forum - 02-18-2010 [eluser]n0xie[/eluser] You forgot to load your model: Code: $this->load->model('Guestbook_model'); A little help with my first app... - El Forum - 02-18-2010 [eluser]invision[/eluser] Many thanks for the fast reply ![]() I'm now getting: Code: An Error Was Encountered Any ideas? A little help with my first app... - El Forum - 02-18-2010 [eluser]n0xie[/eluser] Quote:Model(guestbook.php): Quote:Unable to locate the model you have specified: guestbook_model A little help with my first app... - El Forum - 02-18-2010 [eluser]invision[/eluser] Sorted! Many thanks n0xie. Going to play about with this some more tonight and see how I go. Could you possibly give me some clues how I would take the data retrieved in my model and display it in the view? Thanks so much again. A little help with my first app... - El Forum - 02-18-2010 [eluser]n0xie[/eluser] Code: // model Code: // view A little help with my first app... - El Forum - 02-18-2010 [eluser]invision[/eluser] Wow, n0xie, you're slowly becoming a hero of mine. Many thanks for this. Now to study and learn from it then proceed with the rest of the build ![]() Thank You A little help with my first app... - El Forum - 02-20-2010 [eluser]invision[/eluser] I had thought of starting a new thread, but would prefer to keep this open for a bit. If I wanted to make a model/view/controller for deleting an entry from my 'data' table, how would I best do this? I'd thought of this.... controller: Code: function delete() model: Code: function deleteEntry(){ Does this look about right? I've a feeling it's not ![]() The idea being that they visit ... example.com/guestbook/index.php/delete/2 and it would remove that entry from my table, and return the user to the guestbook. Many thanks for any pointers with this. A little help with my first app... - El Forum - 02-20-2010 [eluser]n0xie[/eluser] You should use the active record class. To answer your question Code: //controller A word of caution though. You should always do any destructive action via a POST, not via a GET request, so I would advice against doing it this way. This is to prevent numerous security issues, the most simple being, what if the Googlespider would index your site and go to the url 'example.com/guestbook/index.php/delete/2'? A little help with my first app... - El Forum - 02-21-2010 [eluser]invision[/eluser] Many thanks for the reply. I'm hoping in time to move this to an Admin dashboard, and just prevent the Googlebot from spidering. Though that's a really good point you make. Just out of interest, how would I do it via a _POST? Would I have to modify my view code? Thanks once again for your patience with this. It's good to start small and get my head around it like this. |