Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Posts
    1

    Unanswered: Notice: Undefined index:

    i write this php code

    //*************************************************
    <?php
    require_once("Connections/connection.php");
    $q_prod_prop = "select * from prop_prod";
    $rs_q_prop_prod = mysql_query($q_prod_prop,$link) or die(mysql_error($link));

    echo "Query :" .$q_prod_prop;
    echo "<br>";
    echo "<br>";
    echo "Total No. of Records :".mysql_num_rows($rs_q_prop_prod);
    echo "<BR>";
    while($rows_rs_q_prop_prod = mysql_fetch_row($rs_q_prop_prod))
    {
    echo $rows_rs_q_prop_prod["prop_id"];
    echo $rows_rs_q_prop_prod["prop_value"];
    }
    ?>
    //************************************************** *

    But output of above php code is
    //**************************************************

    Query :select * from prop_prod

    Total No. of Records :100

    Notice: Undefined index: prop_id in c:\inetpub\wwwroot\sdsdynamic\testing.php on line 13

    Notice: Undefined index: prop_value in c:\inetpub\wwwroot\sdsdynamic\testing.php on line 14

    Notice: Undefined index: prop_id in c:\inetpub\wwwroot\sdsdynamic\testing.php on line 13

    Notice: Undefined index: prop_value in c:\inetpub\wwwroot\sdsdynamic\testing.php on line 14

    Notice: Undefined index: prop_id in c:\inetpub\wwwroot\sdsdynamic\testing.php on line 13

    Notice: Undefined index: prop_value in c:\inetpub\wwwroot\sdsdynamic\testing.php on line 14

    so on....
    //************************************************** ****

    why gives me Notice: Undefined index: prop_value in...
    Plz help me thanx.... in adv..

  2. #2
    Join Date
    Jan 2004
    Posts
    12
    That's because you're using mysql_fetch_row() which only obtains numerical keys for the array. Try using mysql_fetch_assoc() instead.

  3. #3
    Join Date
    Feb 2004
    Posts
    29
    yes, or you can use mysql_array() and mysql_object(), check the php manual.

Posting Permissions

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