Cannot update database record using posted variables |
[eluser]ccalby[/eluser]
Hello, I'm pulling my hair out at the moment. I've been using CI for about a month and cannot figure this out. My intention is to have a URL like this http://domain.com/cmc2/index.php/main/update/<GAMERTAG> (where <GAMERTAG> is a manually entered string. I can load the page find, but I cannot update it as I intend. I have a form setup on the update page that gets data from the database based on the URL. When the user clicks "submit", the data should then be updated in the database. Error message Quote:A Database Error OccurredSimply put, the new Gamertag should be from the form that the user submits, the WHERE gamertag is from the URL (above). Model: Code: function update_record($gamertagold) { Code: function update() Thanks
[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgniter forums! Where are you setting $gamertagold in your controller? It doesn't look like it's being passed to the model method. Also, I would suggest you do a little more validation. What happens if a user picks a gamer tag that's already in use by someone else? Check your table. You'll see that there's an entry in there already where Gamertag is 'bookfgfdg' and Gamertag is '0'. |
Welcome Guest, Not a member yet? Register Sign In |