Page 1 of 1

addslashes problem

Posted: Fri Jul 16, 2004 9:52 am
by FCB
i use the function but the slashes don't show up in the database. I use addslashes in a different script and it works just fine...

Code: Select all

<?php
$alt = $HTTP_POST_VARS['alt'];
$url = $HTTP_POST_VARS['url'];
$img = addslashes('<img src="'.$url.'" alt="'.$alt.'" />');
?>
thanks in advance!
~FCB

Posted: Fri Jul 16, 2004 10:35 am
by pickle
what does $img look like? I'm not sure but I don't think the slashes will show up in the database. Adding slashes escapes the character. So, when it's in a query, MySQL just inserts the escaped character, and doesn't interpret it.

Posted: Fri Jul 16, 2004 5:53 pm
by McGruff
Have a read through the Magic Quotes are Evil link in the Starter Pack at the top of this board.