Cannot delete from database |
(07-22-2017, 10:24 AM)[email protected] Wrote:(07-22-2017, 09:57 AM)Wouter60 Wrote: Please, define "didn't work". Thanks for you time. I got it to work, I just dropped the row and re-added it. Also your link that you sent works as well Thanks to everybody who has chimed in to help me.
(07-22-2017, 11:11 AM)[email protected] Wrote:(07-22-2017, 10:24 AM)[email protected] Wrote:(07-22-2017, 09:57 AM)Wouter60 Wrote: Please, define "didn't work". $post['id'] <- is not the id from the database? if you need to reset the id, you do something wrong very wrong Quote:I need to figure out how to reset the auto increment in the database if I can. At least I think this is the best way to proceed. No it's not. Let your controller fetch the records (optionally via a model), and pass them as an array to the view that shows the table. Use a foreach... structure to display the records. Very basic example: Code: <table> This way, each delete button refers to an existing record.
(07-23-2017, 04:27 AM)Wouter60 Wrote:Quote:I need to figure out how to reset the auto increment in the database if I can. At least I think this is the best way to proceed. Thanks, Even though I fixed the issue I'm in the learning mode and I'm going to take your advice and fetch the records in the Model. For me it's a challenge as I believe it will help me learn how to structure the code better. Again thanks for your input I really appreciate it.
Remember to let your model return the records as an array of objects in order to use the object syntax in the view, like $post->id.
Otherwise, you must use the array syntax: $post['id']. PHP Code: $query = $this->db->order_by('datetime','ASC')->get('posts'); |
Welcome Guest, Not a member yet? Register Sign In |