evmaster Posted January 17, 2007 Share Posted January 17, 2007 Hey everyone,I'm trying to set up a system that lets me post messages on my blog by email.I have an email address set up so that any mail sent to it will be written into the blog's MySQL database (Subject -> message title | Body -> message body).I have a line of code that emails a notification message to my email account just so I know the script has worked.Everything works perfectly, as long as the message is short. If the message is longer than about 2 sentences then nothing will be written into the MySQL, but I still get the notification email which shows the message as I sent it.Using PHPMyAdmin to insert values works fine, no matter how long, and all the other scripts I have tried with my server haven't given me trouble - it seems to have something to do with the fact that the data from an email message.I've attached the script that's giving trouble, with the login info removed of course.Thanks for your time,Evan[attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
btherl Posted January 17, 2007 Share Posted January 17, 2007 The first thing to do is check for errors from your mysql query[code=php:0]mysql_query($createquery) or die("Error in $createquery :" . mysql_error());[/code]Or you may want to add that error to the email notification. Quote Link to comment Share on other sites More sharing options...
evmaster Posted January 17, 2007 Author Share Posted January 17, 2007 Thanks. It says "You have an error in your SQL syntax".I just tried it with a 5 paragraph block of lorem ipsum text and it worked fine - so the problem is not the length of the message, but rather the use of odd characters in the message like quotes or apostrophes.What could cause this issue? It hasn't been a problem before.-Evan Quote Link to comment Share on other sites More sharing options...
evmaster Posted January 17, 2007 Author Share Posted January 17, 2007 Quotes work fine, it seems apostrophies are causing the problem.Maybe I could just use [code]’[/code] instead?-Evan Quote Link to comment Share on other sites More sharing options...
evmaster Posted January 17, 2007 Author Share Posted January 17, 2007 I seem to have fixed this with the addslashes() command.Thanks!-Evan Quote Link to comment 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.