array key problem

Discussion in 'PHP' started by promotingspace.net, Oct 5, 2009.

  1. #1
    Hi
    I place a piece of code and its result. I don't know why array value is not shown.
    Even when I use array_key_exists(), it returns false
    this is the code:
    $sql = mysql_query("SELECT * FROM brokerprices");
    while (list($name,$value) = mysql_fetch_row($sql)) {
    $result[$name]=$value;
    }
    print_r($result);
    echo "<br><br>But there should be '0.79' that is not:".$result[ASAS];
    PHP:
    [​IMG]
     
    promotingspace.net, Oct 5, 2009 IP
  2. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You need to put quotes around that: $result['ASAC'] (not ASAS)
     
    premiumscripts, Oct 5, 2009 IP
  3. promotingspace.net

    promotingspace.net Peon

    Messages:
    361
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I tried that
    In addition, use array_key_exists() is returning false
     
    promotingspace.net, Oct 5, 2009 IP
  4. php-lover

    php-lover Active Member

    Messages:
    261
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    58
    #4
    lol, the $result array does not have a key "ASAS"
     
    php-lover, Oct 6, 2009 IP