You are here: Re: replace single slash with double slash « PHP Programming Language « IT news, forums, messages
Re: replace single slash with double slash

Posted by gosha bine on 09/22/07 19:43

dkirkdrei@yahoo.com wrote:
>
> the code:
>
> <?
> $var = "\\wusais\Intranets\Intranets\fpdb\pdf\weinig\00505882.pdf";
> echo strtr($var, array('\\' => '\\\\'));
> ?>
>
> produces this:
>
> \\wusais\\Intranets\\Intranets\\fpdb\\pdf\\weinig05882.pdf
>
> close but the end is still killing me...
>

If the string is coming from DB as you have said, you shouldn't be
assigning it to $var, but fetch it from the database instead, like this:

$rc = mysql_query("SELECT .....");
$row = mysql_fetch_array($rc);
$var = $row['fieldname'];

echo strtr($var, array('\\' => '\\\\'));


--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация