Place Holders

Codes here !

Moderators: macek, egami, gesf

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

Postby quelle » 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!

Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 1 guest