Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 19th, 2004, 08:06 AM
Registered User
 
Join Date: Jul 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ghalebro Send a message via Yahoo to ghalebro
Default PHP String handling Proglem

Hello friends

I have a problem still facing and my proglem goes like this.

I have to insert some text like ";\ksk';| eGg'eof]– ;f/f dhb'/ " in the database and i did it by using mysql_escape_string() and i got the content in database like this "ljBfno ;d\\\\\\\\\\\\\\\'bfodf hfg] qmd a9\\\\\\\\\\\\\\\\bf]"but I want to remove all the backslashes(\\\\\\\\\\\\\\\) and want only one or two back slashes so that i can show the text properly in the page. Please send me any suggestions or solutions of this question.


 
Old August 19th, 2004, 08:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Why not use the addslashes and stripslashes functions, instead?
http://uk2.php.net/manual/en/function.addslashes.php
http://uk2.php.net/manual/en/function.stripslashes.php

Also, bear in mind that (to quote the manual):
The PHP directive magic_quotes_gpc is on by default, and it essentially runs addslashes() on all GET, POST, and COOKIE data. Do not use addslashes() on strings that have already been escaped with magic_quotes_gpc as you'll then do double escaping. The function get_magic_quotes_gpc() may come in handy for checking this.

Take it easy,
Dan





Similar Threads
Thread Thread Starter Forum Replies Last Post
decrypt a string converted by a php md5 algorithm? kawak_zx7 General .NET 8 September 15th, 2006 06:51 AM
Javascript to PHP string iwarlord PHP How-To 0 August 13th, 2006 11:13 PM
Apache - PHP directory handling... richcon Pro PHP 1 June 28th, 2006 07:36 PM
Error: movie.php & commit.php on p182-186, ch6 willburke BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 October 12th, 2004 02:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.