rsammy Posted September 26, 2007 Share Posted September 26, 2007 i use an apostrophe or single quote in a blob and it returns an error. any message without the apostrophe passes on smooth. is there some escape character or something i need to use for this one? thanks Link to comment https://forums.phpfreaks.com/topic/70748-solved-apostrophe-or-single-quote-in-a-blob/ Share on other sites More sharing options...
rarebit Posted September 26, 2007 Share Posted September 26, 2007 What's 'it' ? Sometimes my html trips with ', however mysql trips on '... Generally the escape character is \ Post an example... Link to comment https://forums.phpfreaks.com/topic/70748-solved-apostrophe-or-single-quote-in-a-blob/#findComment-355683 Share on other sites More sharing options...
d.shankar Posted September 26, 2007 Share Posted September 26, 2007 This probably is an SQL Injection attack. Use this function to avoid errors. mysql_real_escape_string() Link to comment https://forums.phpfreaks.com/topic/70748-solved-apostrophe-or-single-quote-in-a-blob/#findComment-355686 Share on other sites More sharing options...
rsammy Posted September 26, 2007 Author Share Posted September 26, 2007 thanx a lot for replying, shankar. im sure its an sql issue. this is where i am stuck $querye =("INSERT INTO messages (message, user_id,status,subject,from_p,received,to_email,time_sent, clientid, tran_ID) VALUES ('$message','$to_id','1','$subject','$PHY_EMAIL','$DATE','$to','$TIME', '$client_id', '$unqID') "); $resulte=mysql_query($querye); if (!$resulte) { $error="Error 441"; } in the query above, '$message' is a blob - a combination of several fields. one of the fields - follow up notes - contains this special character. and thats what is failing. how do i use mysql_real_escape_string() in this query? im sure the single quote(') in this blob is failing the query - i keep getting error 441. i need this real quick - thanx again. Link to comment https://forums.phpfreaks.com/topic/70748-solved-apostrophe-or-single-quote-in-a-blob/#findComment-355786 Share on other sites More sharing options...
rarebit Posted September 26, 2007 Share Posted September 26, 2007 http://uk3.php.net/manual/en/function.mysql-real-escape-string.php Link to comment https://forums.phpfreaks.com/topic/70748-solved-apostrophe-or-single-quote-in-a-blob/#findComment-355787 Share on other sites More sharing options...
chocopi Posted September 26, 2007 Share Posted September 26, 2007 just use $message = mysql_real_escape_string($message); $to_id = mysql_real_escape_string($to_id); etc on all of your variables you are posting into the database before the query ~ Chocopi Link to comment https://forums.phpfreaks.com/topic/70748-solved-apostrophe-or-single-quote-in-a-blob/#findComment-355788 Share on other sites More sharing options...
rsammy Posted September 26, 2007 Author Share Posted September 26, 2007 thanx chocopi! it worked. thanx to all the replies. appreciate ur help guys Link to comment https://forums.phpfreaks.com/topic/70748-solved-apostrophe-or-single-quote-in-a-blob/#findComment-355830 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.