www.webdeveloper.com
Results 1 to 5 of 5

Thread: [RESOLVED] PHP Notice: Undefined variable

  1. #1
    Join Date
    Jun 2006
    Posts
    266

    resolved [RESOLVED] PHP Notice: Undefined variable

    Still learning SQL. Why would the following give PHP Notice: Undefined variable:
    PHP Code:
    # see if room already exists
    $queryRoom 
    SELECT NVL(COUNT(*),0) AS ROOM
    FROM schema.table
    WHERE room = '" 
    $_SESSION['room'] . "'
    "
    ;
    $room ociparse($connect$queryRoom);
    ociexecute($room);
                
    $roomMatch ociresult($room"ROOM");
                
    if ( 
    $roomMatch )  # found existing room name
    {
      
    $roomNum ociresult($room,"ROOM_NUM");
    }

    echo 
    "<br>room_num of match: " $roomNum

  2. #2
    Join Date
    Jul 2005
    Location
    South Carolina
    Posts
    395
    This question belongs on the PHP forum actually. My guess is that "room" was not set. Perhaps look into incorporating the isset() function?

  3. #3
    Join Date
    Jun 2006
    Posts
    266
    Thanks for the reply. Should I go post it there? By the way, I had entered data into the field objects. They SHOULD have been set. I'm trying to figure out why they are not.

  4. #4
    Join Date
    Jul 2005
    Location
    South Carolina
    Posts
    395
    I would suggest sending a request to the moderator to have the post moved. Otherwise they might 'slap you on the wrist' for posting the same thing in two forums (I know this from experience ).

    Maybe you could do something like
    PHP Code:
    function doAlert(msg) {
         echo 
    "<script type=\"text/javascript\">alert('".msg."');</script>";
    }
    if (isset(
    $_SESSION["room"])) {
         
    doAlert("room is set");
    }
    else {
         
    doAlert("room is not set");

    to at least see if it's set? I'm not an expert at PHP by any stretch of the imagination.
    Last edited by bubbisthedog; 08-24-2007 at 02:10 PM.

  5. #5
    Join Date
    Feb 2003
    Location
    Aberdeen, Washington, USA
    Posts
    1,859
    Moved to the PHP forum by request of the thread starter...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles