Jump to content

Quick addslashes Issue


cursed

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.