mattiesams Posted October 22, 2008 Share Posted October 22, 2008 hi, when i try to add inter'l in the field i'm getting below error message. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'L', '')' at line 4 but i have put $sql = "UPDATE inv SET "; $sql .= ", TO_LOC3 = '".mysql_real_escape_string($_SESSION['dloc3'])."'"; $sql .= " WHERE JOB_NO = ".$_SESSION['jobno']; but when i go back using back button , i can see that inter'l already in the field. then again if i tried to delete that , then i'm getting above error message. this is how i call data $sql = "SELECT * FROM inv WHERE JOB_NO = ".$id; $db->query($sql); if ($row = $db->next_record()) { $_SESSION['dloc3'] = stripslashes($row['TO_LOC3']); can someone help me please to solve this many thanks Link to comment https://forums.phpfreaks.com/topic/129501-mysql_real_escape_string-issue-in-php-code/ Share on other sites More sharing options...
trq Posted October 22, 2008 Share Posted October 22, 2008 This comma (in red) should not be there. $sql .= ", TO_LOC3 = '".mysql_real_escape_string($_SESSION['dloc3'])."'"; Link to comment https://forums.phpfreaks.com/topic/129501-mysql_real_escape_string-issue-in-php-code/#findComment-671407 Share on other sites More sharing options...
mattiesams Posted October 22, 2008 Author Share Posted October 22, 2008 , is there because there are lot of other fields i'm inserting into DB. i've used only this line to show u what i'm trying to do. deos anyone has an idea how to fix this bug? Link to comment https://forums.phpfreaks.com/topic/129501-mysql_real_escape_string-issue-in-php-code/#findComment-671410 Share on other sites More sharing options...
trq Posted October 22, 2008 Share Posted October 22, 2008 echo $sql and lets see what you have. Link to comment https://forums.phpfreaks.com/topic/129501-mysql_real_escape_string-issue-in-php-code/#findComment-671411 Share on other sites More sharing options...
mattiesams Posted October 22, 2008 Author Share Posted October 22, 2008 if that field is total empty if i try to input internation'l there, then i get then i'll get this error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'L')' at line 4 then when i go back clicking back on error screen then i can see internation'l when i echo sql i can see internation'l Link to comment https://forums.phpfreaks.com/topic/129501-mysql_real_escape_string-issue-in-php-code/#findComment-671418 Share on other sites More sharing options...
trq Posted October 22, 2008 Share Posted October 22, 2008 echo $sql and lets see what you have. Link to comment https://forums.phpfreaks.com/topic/129501-mysql_real_escape_string-issue-in-php-code/#findComment-671508 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.