The online racing simulator
SQL Problem....
(4 posts, started )
SQL Problem....
I having trouble when inserting a block of text into my database. I think i have narrowed down the problem as something to do with apostriphies, you know the ''''''' things....

Can anyone shed some light on this? I'm using PHP and MySQL.

The 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 first driver in the WTCC', `text` = 'The first round of the FIA World Touring ' at line 1

#2 - ikkah
http://php.net/manual/en/funct ... ql-real-escape-string.php

Try that. Since ' is used to mark where the text string starts and ends, you'll have to avoid using that character. That is, if you have a string like 'ikkah's head', MySQL will think the string is only 'ikkah' and the rest is syntax error. Check that URL, it's probably explained better there.
the problem is i have to use that character in the text i'm inserting....
man my head is wrecked with this....
-
(thisnameistaken) DELETED by thisnameistaken
hmmm... i tried what u said before kev and it didn't seem to work.
Maybe i was missing a ; or something....
Anyway i found a way around it by using:
$str = str_replace("'","''",$str);

Double apostrophe gets ignored or so i believe....
-
(thisnameistaken) DELETED by thisnameistaken

SQL Problem....
(4 posts, started )
FGED GREDG RDFGDR GSFDG