single quote escape questions

From: Date: Tue, 20 Apr 2004 13:23:52 +0000
Subject: single quote escape questions
Groups: php.general 
Request: Send a blank email to php-general+get-183982@lists.php.net to get a copy of this message
I would like some advice on special/reserved chars in strings, especially single quotes. I am developing an application that requires using a Name field in the url for navigation. I have a case where "Toni's" in the url is returned in $_SERVER['PATH_INFO'] as "Toni\'s" eventhough the address bar shows "Toni's". I can easily add the code to stripslashes from the vars I extract, but is the single quote the only char that is an issue here? Is this a server addition or a client/browser addition? The server has magic quotes set off, so that is not the issue. Secondly, what is best/favorite way to escape chars for mysql? I know that mysql_real_escape_string() has been recommended recently. But that brings up the issue of magic quotes. Would set_magic_quotes_runtime(0) be a reliable way of making sure my code runs with magic quotes off? Thanks for your time, Kathleen

« previous php.general (#183982) next »