Jump to content

Kosonome

New Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by Kosonome

  1. Undefined index: first_name in (my file name) on line 41
    Undefined index: last_name in (my file name) on line 42

     

    "Undefined index" errors occurs when you trying accessing something that does not exists.
     
    When you first put
    if ($_SESSION['logged_in'] = true)

    Inside $_SESSION['logged_in'] is now 'true'. Since it's a session, it stays like that until you clear your cookies/session in your browser. Or session_destroy().

     

    Because it's true, and you fixed to '==', it's entering this condition now, but inside $_SESSION['first_name'] there is nothing.

  2. "status": "success",
      "data": {
        "network": "DOGE",
        "prices": [
          {
            "price": "0.00003556",
            "price_base": "LTC",
            "exchange": "cryptsy",
            "time": 1401185325
          }
        ]
      }
    

    I know I can access the top value like this.

    echo $access->status;
    

    But how do I access the sub values underneath? The ones in "data"?

     

     

    Not sure if that's what you meant:

     

    [ ] = means array in JSON

     

    I think you need access like that:

    echo $access->data->prices[0]->price;

     

    or

     

    echo $access->data->prices[1]->price; // this will get an error, maybe the api can give you more than one "price"

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.