Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Undefined index: orderBy
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



Report this thread to moderator Post Follow-up to this message
Old Post
Hamish McCracken
09-25-04 01:56 AM


Re: Undefined index: orderBy
Hamish 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




Report this thread to moderator Post Follow-up to this message
Old Post
Janwillem Borleffs
09-25-04 01:56 AM


Re: Undefined index: orderBy
On 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


Report this thread to moderator Post Follow-up to this message
Old Post
Lāʻie Techie
09-27-04 08:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Language archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:23 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.