Hi,
Please help me as i am very new to php.
Is their any php function which can help me do following thing.
i.e http://www.domainname.com/xyzinfo.php?xyzid=50
i want function to just return me the xyzid, for eg in above case 50.
Thank You,
Php function
Moderator: General Moderators
Re: Php function
What you're referring to is a GET parameter. PHP passes them to the script as part of the $_GET superglobal.
-
sejpal.dipesh
- Forum Newbie
- Posts: 2
- Joined: Wed Jun 02, 2010 10:36 am
Re: Php function
Thank you for your quick reply but this is not what i want.
I just want the id, i know it can be done via string function,
it would be great if you can guide me with that.
I just want the id, i know it can be done via string function,
it would be great if you can guide me with that.
- phdatabase
- Forum Commoner
- Posts: 83
- Joined: Fri May 28, 2010 10:02 am
- Location: Fort Myers, FL
Re: Php function
Code: Select all
$string = 'http://www.domainname.com/xyzinfo.php?xyzid=50';
$string = str_replace( '?', '', strstr( $string, '?');
$string = strstr( $string, '=', true);
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Php function
Code: Select all
parse_str(parse_url('http://www.domainname.com/xyzinfo.php?xyzid=50', PHP_URL_QUERY));
echo $xyzid;mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.