Code Comments
Programming Forum and web based access to our favorite programming groups.Hi,
I have the following code to determine how I want my results (pulled from a
database) ordered.
if (!$_GET['orderBy']) {
$orderBy = "startDate";
} else {
$orderBy = $_GET['orderBy'];
if ($orderBy=="") {
$orderBy = "startDate";
}
}
I can't remember (been a while since I've used php) how to determine whether
or not a query string variable is present and if it isn't return a value for
the defined variable. At the moment, when no query string is present I get
the error: Notice: Undefined index: orderBy
When there is a query string, obviously there is no error.
Many thanks in advance.
Cheers
Hamish
Post Follow-up to this messageHamish McCracken wrote: > I can't remember (been a while since I've used php) how to determine > whether or not a query string variable is present and if it isn't > return a value for the defined variable. At the moment, when no query > string is present I get the error: Notice: Undefined index: orderBy > www.php.net/isset JW
Post Follow-up to this messageOn Sat, 25 Sep 2004 01:00:56 +0200, Janwillem Borleffs wrote: > Hamish McCracken wrote: > www.php.net/isset how about array_key_exists? HTH, La'ie Techie
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.