Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/189509-quick-addslashes-issue/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.