Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Place Holders

Codes here !

Moderators: macek, egami, gesf

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!
quelle
New php-forum User
New php-forum User
 
Posts: 8
Joined: Tue Aug 20, 2002 11:57 am

Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.