You are here: Re: check to see if a string contains sudden elements « PHP « IT news, forums, messages
Re: check to see if a string contains sudden elements

Posted by M. Sokolewicz on 03/06/05 15:41

Reinhart Viane wrote:
> I have a page which gets the id of a user from the url.
>
> $_GET[id]
>
>
>
> Now this id can have two forms:
>
> Normal: page.php?id=1
>
> Not so normal: page.php?id=whatever|1
>
>
>
> I can explode the second string so I only have the number (1). Explode ("|",
> $_GET(id))
>
> But this command fails my query in case we have a normal value
>
>
>
> Is there a way to check the $_GET(id) to see if there is a | in it and in
> that case explode it?
>
>
>
> Thx in advance.
>
> Reinhart
>
>
$ret = explode('|', $_GET['id']);
if(count($ret) > 1) {
$id = $ret[1];
} else {
$id = $ret[0];
}

 

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

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