flemingmike Posted September 27, 2010 Share Posted September 27, 2010 hello, i am returning the error in the following code. im i doing something wrong? {$sql = "UPDATE jobs SET contact = ' . mysql_real_escape_string{$_POST['contact']} .', contactphone = ' . mysql_real_escape_string{$_POST['contactphone']} .', customer = ' . mysql_real_escape_string{$_POST['customer']} .', initial = ' . mysql_real_escape_string{$_POST['initial']} .', address = ' . mysql_real_escape_string{$_POST['address']} .', city = ' . mysql_real_escape_string{$_POST['city']} .', postal = ' . mysql_real_escape_string{$_POST['postal']} .', province = ' . mysql_real_escape_string{$_POST['province']} .', description = ' . mysql_real_escape_string{$_POST['description']} .', mechanic = ' . mysql_real_escape_string{$_POST['mechanic']} .', ponumber = ' . mysql_real_escape_string{$_POST['ponumber']} .', status = ' . mysql_real_escape_string{$_POST['status']} .' WHERE id = '$id"; $result = mysql_query($sql) or die('Error, updating job failed. Check you fields and try again.');echo "<center> You have successfully updated the new job. You can see your changes below.";} Quote Link to comment https://forums.phpfreaks.com/topic/214519-insert-with-not-working/ Share on other sites More sharing options...
trq Posted September 27, 2010 Share Posted September 27, 2010 Your mixing single and double quotes. Quote Link to comment https://forums.phpfreaks.com/topic/214519-insert-with-not-working/#findComment-1116254 Share on other sites More sharing options...
flemingmike Posted September 27, 2010 Author Share Posted September 27, 2010 so should ' . mysql_real_escape_string{$_POST['contact']} .' really be " . mysql_real_escape_string($_POST['contact']) ." Quote Link to comment https://forums.phpfreaks.com/topic/214519-insert-with-not-working/#findComment-1116258 Share on other sites More sharing options...
trq Posted September 27, 2010 Share Posted September 27, 2010 Whenever you have an opening double quote, you need a closing double quote. Same goes for single quotes. If you open with a single, you need to close with a single. Quote Link to comment https://forums.phpfreaks.com/topic/214519-insert-with-not-working/#findComment-1116260 Share on other sites More sharing options...
flemingmike Posted September 27, 2010 Author Share Posted September 27, 2010 i thought i did that...? Quote Link to comment https://forums.phpfreaks.com/topic/214519-insert-with-not-working/#findComment-1116263 Share on other sites More sharing options...
flemingmike Posted September 27, 2010 Author Share Posted September 27, 2010 ookkkk.... i get it now, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/214519-insert-with-not-working/#findComment-1116264 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.