Closed Thread
Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: unidentified index i need help

  1. #11
    hardinera's Avatar
    hardinera is offline Learning Programmer
    Join Date
    Jul 2009
    Posts
    42
    Rep Power
    0

    Re: unidentified index i need help

    it returns
    Array
    (
    )

    unidentified index....

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #12
    abdul.gafur's Avatar
    abdul.gafur is offline Learning Programmer
    Join Date
    Mar 2010
    Location
    Salo, Riau, Indonesia
    Posts
    42
    Rep Power
    0

    Re: unidentified index i need help

    ya, but if you select combobox then click on generate

    Result if you selected single room:
    Array
    (
    [room] => single room
    )

    room type : single room
    just a drop of dew in the morning
    ( loop while (= x true) do (x) )

  4. #13
    hardinera's Avatar
    hardinera is offline Learning Programmer
    Join Date
    Jul 2009
    Posts
    42
    Rep Power
    0

    Re: unidentified index i need help

    aw... my rooms are connected to the database...

  5. #14
    abdul.gafur's Avatar
    abdul.gafur is offline Learning Programmer
    Join Date
    Mar 2010
    Location
    Salo, Riau, Indonesia
    Posts
    42
    Rep Power
    0

    Re: unidentified index i need help

    try this :

    Code:
    <?php
    if (isset($_GET["room"])) {
    $username "root";
    $password "";
    $host "localhost";
    $database "h_reservation";
    $connection = @mysql_connect($host$username$password) or die("Can not connect to database: ".mysql_error());
    $db = @mysql_select_db($database) or die("Can not select the database: ".mysql_error());
     
    $mode $_GET["room"] ;
                        
    echo 
    "<h3> room type : $mode </h3><hr>";

    //DISPLAYING CONTENT!!

    $select mysql_query("SELECT * FROM guest_info where room_type = '$mode'"); 
    if (!
    $select) {
        echo 
    mysql_error();

    $total 0;

    while(
    $row mysql_fetch_assoc($select)){

    echo 
    "guest id : ""&nbsp;" $row['guest_id'
    $row['room_type']  . "<br>"
    "&nbsp;" $row['check_in'] . "&nbsp;" "to" ."&nbsp;"  
    "&nbsp;" $row['check_out'

    "<br>" "<br>";

    $total $total ;

    }

    echo 
    "<hr>";

    //COUNTING CONTENT 
    echo "<h1>-----------------total number of reservation-----------------------</h1>" "<br>" "<br>";
    echo 
    "<h1>  $total </h1><hr>";
    }
    ?>
    if you access it for first time, $mode is not assigned. use isset to determine whether $mode has a value or not
    just a drop of dew in the morning
    ( loop while (= x true) do (x) )

  6. #15
    hardinera's Avatar
    hardinera is offline Learning Programmer
    Join Date
    Jul 2009
    Posts
    42
    Rep Power
    0

    Re: unidentified index i need help

    do you know how to make
    Code:
     $mode $_GET["room"] ; 
    have a value after loading? i think thats the problem.. because when $mode does have value the unidentified dissapears..

  7. #16
    abdul.gafur's Avatar
    abdul.gafur is offline Learning Programmer
    Join Date
    Mar 2010
    Location
    Salo, Riau, Indonesia
    Posts
    42
    Rep Power
    0

    Re: unidentified index i need help

    I've tried your code, my friend. There is no error I found. $mode have a value after loading.

    I think the problem is not about the code. Maybe error because environment you work with.
    I don't have clue anymore
    just a drop of dew in the morning
    ( loop while (= x true) do (x) )

  8. #17
    hardinera's Avatar
    hardinera is offline Learning Programmer
    Join Date
    Jul 2009
    Posts
    42
    Rep Power
    0

    Re: unidentified index i need help

    me too... i dont know whats the problem because i dont see any... except for that unidentified index... anyways thanks for the help really appreciate

  9. #18
    abdul.gafur's Avatar
    abdul.gafur is offline Learning Programmer
    Join Date
    Mar 2010
    Location
    Salo, Riau, Indonesia
    Posts
    42
    Rep Power
    0

    Re: unidentified index i need help

    I think you have problem with server, what server you used?
    just a drop of dew in the morning
    ( loop while (= x true) do (x) )

  10. #19
    Join Date
    Jul 2006
    Location
    Amherst, New York, United States
    Posts
    6,277
    Blog Entries
    26
    Rep Power
    20

    Re: unidentified index i need help

    There is no error, there is a warning. Depending on your servers php configuration, it may display warnings, or it might not. Most servers hide warnings. The warning is generated because when the page first loads $_GET['mode'] does not exist (and therefore undefined). It is defined (or is set) _after_ you submit the forum. As abdul.gafur suggested in post #14, you may use isset to test if a variable exists (note how this is different from checking if a variable has a value which will generate the warning you are seeing).

  11. #20
    hardinera's Avatar
    hardinera is offline Learning Programmer
    Join Date
    Jul 2009
    Posts
    42
    Rep Power
    0

    Re: unidentified index i need help

    im using wamp server..

Closed Thread
Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. A-Z Index
    By jwg2s in forum PHP Development
    Replies: 2
    Last Post: 06-07-2011, 08:54 AM
  2. Replies: 1
    Last Post: 07-20-2010, 12:46 PM
  3. Replies: 7
    Last Post: 01-24-2010, 10:02 PM
  4. z-index problem
    By tomitzel in forum JavaScript and CSS
    Replies: 1
    Last Post: 11-05-2009, 10:37 AM
  5. iframes on index.php
    By Hektor in forum Linux/Unix General
    Replies: 6
    Last Post: 11-14-2007, 06:12 AM

Tags for this Thread

Bookmarks

Posting Permissions

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