Quotes driving me crazy :-)
| From: | Digital Hit Entertainment | Date: | Thu, 29 Jun 2000 00:04:28 +0000 |
| Subject: | Quotes driving me crazy :-) | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-723@lists.php.net to get a copy of this message | ||
[Working with PHP3 on a shared NT server. No access to php.ini. ODBC
connection to an MS SQL Server 7 database]
I was having problems with single quotes. The magic_quotes setup in the
ISP's php.ini was driving my SQL Server 7 nuts. The following two lines
took care of all the insert display problems I was having:
$sql = str_replace("\'","''",$sql);
$sql = stripslashes($sql);
The first allowed me to insert the singles and the second the doubles.
My next big challenge concerns xhtml compliance and inserting clickable
URLS in the article in my database.
I initally searched for the double quotes and replaced them with ".
Worked fine for stuff like "I love PHP," he said.
Where I'm still having problems is making my URLs clickable and
compliant _and_ SQL friendly.
<a href="/pageonmysite.html">A page</a> hangs up the insert form.
<a href="/pageonmysite.html">A page</a> creates a link but the
" throws off the address in the browser and makes it
http://www.site.com/"pageonmysite.html"
instead of
http://www.site.com/pageonmysite.html
Any advice would be appreciated.
--
Ian Evans