Undefined index: orderBy

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default 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


    Hamish McCracken Guest

  2. Similar Questions and Discussions

    1. Undefined index: REQUEST_METHOD
      Hi there, I have installed a search engine on one of my websites - it had a few bugs in it, I got all but one out of the script. The results...
    2. Undefined index in form with checkbox
      I had a form working with a couple of checkboxes using the mail() function that takes the user to a simple "thanks for your input" page using the...
    3. #25968 [Opn->Bgs]: $_SERVER['REQUEST_URI'] - Undefined index
      ID: 25968 Updated by: sniper@php.net Reported By: bob at rsi dot com -Status: Open +Status: Bogus...
    4. What is an undefined offset? An undefined index?
      I just switched error_reporting to ALL so I could debug my site. I got a huge page full of errors. One of the most common was that in my arrays I'm...
    5. Undefined index
      i have two file with jobapp.html calling jobapp_action.php <HTML> <!-- jobapp.html --> <BODY> <H1>Phop's Bicycles Job Application</H1> <P>Are...
  3. #2

    Default 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
    >
    [url]www.php.net/isset[/url]


    JW



    Janwillem Borleffs Guest

  4. #3

    Default Re: Undefined index: orderBy

    On Sat, 25 Sep 2004 01:00:56 +0200, Janwillem Borleffs wrote:
    > 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
    >>
    >>
    > [url]www.php.net/isset[/url]
    how about array_key_exists?

    HTH,
    La'ie Techie

    Lāʻie Techie Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139