Place Holders

Codes here !

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 8
Joined: Tue Aug 20, 2002 11:57 am

Mon Mar 24, 2003 10:16 pm

' and " can be valid data, so long as they are properly escaped.
For example, if you wanted to insert the word you're you would have to insert you\'re. Eg.
INSERT INTO table VALUES('you\'re');

To escape your strings in PHP use the addslashes function:

Code: Select all

   $before = "you're";
   $after = addslashes($before);
You should be able to insert $after without any errors. Try echoing $before and $after to see the difference.

Hope this helps!

Post Reply