waynew Posted June 24, 2008 Share Posted June 24, 2008 ??? Okay, I'm stumped on this one which means that it's probably something really simple after going wrong and that I need a second pair of eyes. Any help would be great. I have a table that was set up as follows: mysql_query("CREATE TABLE letter_template( template_id int(2) not null, primary key(template_id), template_type varchar(20), lost_tender text, won_tender text, pending_tender text )") or die("Problem"); mysql_query("INSERT INTO letter_template( template_id, template_type, lost_tender, won_tender, pending_tender) VALUES(1, 'Regular', 'Default', 'Default', 'Default')") or die(mysql_error); Now, that worked fine and all fields were filled. The problem is on my update page: if(isset($_POST['update'])){ $won = mysql_real_escape_string($_POST['won_tender']); $lost = mysql_real_escape_string($_POST['lost_tender']); $pending = mysql_real_escape_string($_POST['pending_tender']); var_dump($_POST); mysql_query("UPDATE letter_template SET won_tender = '$won', SET lost_tender = '$lost', SET pending_tender = '$pending' WHERE template_type = 'Regular' ") or die("Problem"); mysql_close(); } As you can, I've done a var dump, which turned up fine. The problem is with the actual query update. Quote Link to comment https://forums.phpfreaks.com/topic/111653-solved-update-problem/ Share on other sites More sharing options...
trq Posted June 24, 2008 Share Posted June 24, 2008 Replace... or die("Problem"); with.... or die(mysql_error()); and php will likely tell you what the problem is. Quote Link to comment https://forums.phpfreaks.com/topic/111653-solved-update-problem/#findComment-573119 Share on other sites More sharing options...
waynew Posted June 24, 2008 Author Share Posted June 24, 2008 ??? Use of undefined constant mysql_error - assumed 'mysql_error' in C:\Apache\htdocs\editlettercontent.php on line 37 mysql_error Quote Link to comment https://forums.phpfreaks.com/topic/111653-solved-update-problem/#findComment-573120 Share on other sites More sharing options...
waynew Posted June 24, 2008 Author Share Posted June 24, 2008 Does anyone know what that error means? Quote Link to comment https://forums.phpfreaks.com/topic/111653-solved-update-problem/#findComment-573127 Share on other sites More sharing options...
trq Posted June 24, 2008 Share Posted June 24, 2008 No, add... or die(mysql_error()); Notice the () as in mysql_error() ? Quote Link to comment https://forums.phpfreaks.com/topic/111653-solved-update-problem/#findComment-573128 Share on other sites More sharing options...
trq Posted June 24, 2008 Share Posted June 24, 2008 Does anyone know what that error means? It means you didn't copy my code correctly. Quote Link to comment https://forums.phpfreaks.com/topic/111653-solved-update-problem/#findComment-573129 Share on other sites More sharing options...
waynew Posted June 24, 2008 Author Share Posted June 24, 2008 Sorry, I was in a rush and didn't realise I hadn't put in the brackets SET pending_ten' at line 3 Quote Link to comment https://forums.phpfreaks.com/topic/111653-solved-update-problem/#findComment-573131 Share on other sites More sharing options...
trq Posted June 24, 2008 Share Posted June 24, 2008 What error are you now getting? Quote Link to comment https://forums.phpfreaks.com/topic/111653-solved-update-problem/#findComment-573178 Share on other sites More sharing options...
waynew Posted June 24, 2008 Author Share Posted June 24, 2008 Oh sorry. I fixed it. The problem was with the SQL statement I used SET numerous times when I only needed to use it once. Don't know how I didn't realise that. Quote Link to comment https://forums.phpfreaks.com/topic/111653-solved-update-problem/#findComment-573197 Share on other sites More sharing options...
trq Posted June 24, 2008 Share Posted June 24, 2008 Hehe, I don't know how I didn't see it either. These things happen huh. Quote Link to comment https://forums.phpfreaks.com/topic/111653-solved-update-problem/#findComment-573236 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.