Page 1 of 1

Inserting ' into mysql fields

Posted: Sun Sep 24, 2006 10:01 am
by eyal
Hello,

When I'm inserting the char ' php thinks I'm done writing, altough it's only part of my sentence.

For example, if I have a want to enter a sentece: I'm here
Php will read it like this

Code: Select all

mysql_query("INSERT INTO table(field) VALUES('I'm here')")
What should I do?

Thank you.

Posted: Sun Sep 24, 2006 10:16 am
by feyd

Posted: Sun Sep 24, 2006 10:43 am
by eyal
Thank you, Altough I'm having an error when I'm using the function:
Fatal error: Call to undefined function: mysql_real_escape_string() in c:\apache\htdocs\direct_site\try3\3.php on line 45
After I wrote:

Code: Select all

$var=mysql_real_escape_string($var);
Any Idea what should I do?

Thank once again.

Posted: Sun Sep 24, 2006 10:45 am
by feyd
It would appear you're using a fairly old version of PHP. mysql_escape_string() then.