Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Notice: Undefined index: prop_id in

    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 it gives me Notice: Undefined index: prop_value in...
    Plz help me thanx.... in adv..

  • #2
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    When you use mysql_fetch_row(), a numerical index is returned, to achieve what you want you should use mysql_fetch_assoc().

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Sheffield, UK
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts
    or kill two birds with one stone and use mysql_fetch_Array() which will return both a numberic and associative array at negligible extra parsing to the aforementioned functions
    "To be successful in IT you don't need to know everything - just where to find it in under 30 seconds"

    (Me Me Me Me Me Me Me Me Me)

  • #4
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    have to disagree there, only use mysql_fetch_array() if you NEED both array types, as it is slower than mysql_fetch_assoc().


  •  

    Posting Permissions

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