cursed Posted January 23, 2010 Share Posted January 23, 2010 Code: if (!empty($title) && !empty($page)) { addslashes($title); addslashes($page); addslashes($link); mysql_connect("localhost", "user", "pass") or die(mysql_error()); mysql_select_db("database") or die(mysql_error()); $query = mysql_query("SELECT * FROM content WHERE title='$title'"); if(@mysql_num_rows($query)!=0) { echo "carry on with script"; } else { echo "adding"; mysql_query("INSERT INTO content (content, url) VALUES('$page', '$link' ) ") or die(mysql_error()); } A lot of miscellany (might be important?) and wrongly formatted code but when I execute this code I 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 's announced the new iPhone, a refresh to the Pro line (or that it's being scrapp' at line 2 This happens every single time on the first or second sentence. The code that is inserted is HTML. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/189509-quick-addslashes-issue/ Share on other sites More sharing options...
cursed Posted January 23, 2010 Author Share Posted January 23, 2010 I am a dumbass :'( Forgot to assign the addslashes variables. do'h. Quote Link to comment https://forums.phpfreaks.com/topic/189509-quick-addslashes-issue/#findComment-1000309 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.