View Full Version : error message

01-22-2004, 09:11 AM
Cans someone tell me why this would be happening:

Here is the script:

$eresult = mysql_db_query($url, "SELECT * FROM tstyles WHERE sid>0");
while ($erow = mysql_fetch_array($eresult)) {
$title = $erow["title"];
$rule = $erow["rule"];
echo " - $title / $rule - <br>";
mysql_db_query($database, "INSERT INTO tstyles (title, rule, url) VALUES ('$title', '$rule', '$url')") or die ("ERROR: ". mysql_error());

Now, on the first attempt - $rule has a value of:

Rated & Protected Tables. Double 6's, 5's Up with All Options up to 100 points.

And this is the error message I get:

ERROR: You have an error in your SQL syntax near 's, 5's Up with All Options up to 100 points.', 'drdoms')' at line 1

Is this being caused because $rule has ' in it. If so, why? Never has before - I have over 50 tables with about 10 records each that I am trying to move into the one table, so really dont want to do it manually just because it has ' in it.

Any advice would be greatly appreciated.

Thanks in advance :thumbsup:

01-22-2004, 09:46 AM
Okay - I added "addslashes()" in order to get the $message in the database, what I don't understand is why did it allow it in there in the first place? EG. When someone put the message into my original table, why does it allow it to go in and yet now it wont for me!!!???