Jump to content

Stacker

New Members
  • Posts

    4
  • Joined

  • Last visited

About Stacker

  • Birthday 02/25/1993

Profile Information

  • Gender
    Male
  • Location
    Berkshire, UK
  • Interests
    Audio visual / vehicles / programming
  • Age
    27

Contact Methods

  • Skype
    gibbons.steven

Recent Profile Visitors

460 profile views

Stacker's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok I've managed to work it out, the answer was this: $return = json_decode($response, true); foreach($return as $key) { foreach($key['tickets'] as $ticket) { echo $ticket['ticketNumber']."-"; echo $ticket['title']."-"; echo $ticket['content']; echo '<br />'; } } Cheers!
  2. Sorry my bad, let me try that again! array(2) { ["status"]=> string(7) "success" ["data"]=> array(6) { ["name"]=> string(6) "Steven" ["email"]=> string(26) "xxx" ["staff"]=> bool(false) ["verified"]=> bool(true) ["tickets"]=> array(2) { [0]=> array(17) { ["ticketNumber"]=> string(6) "723789" ["title"]=> string(16) "my second ticket" ["content"]=> string(48) "This is my not my first ticket, I hope it works" ["department"]=> array(2) { ["id"]=> string(1) "1" ["name"]=> string(7) "Support" } ["date"]=> string(12) "202004031053" ["file"]=> NULL ["language"]=> string(2) "en" ["unread"]=> bool(false) ["unreadStaff"]=> bool(true) ["closed"]=> bool(false) ["priority"]=> string(3) "low" ["author"]=> array(6) { ["id"]=> string(1) "2" ["name"]=> string(6) "Steven" ["staff"]=> bool(false) ["profilePic"]=> NULL ["email"]=> string(26) "xx" ["customfields"]=> array(0) { } } ["owner"]=> NULL ["events"]=> array(0) { } ["tags"]=> array(0) { } ["edited"]=> NULL ["editedTitle"]=> NULL } [1]=> array(17) { ["ticketNumber"]=> string(6) "318070" ["title"]=> string(16) "my second ticket" ["content"]=> string(48) "This is my not my first ticket, I hope it works" ["department"]=> array(2) { ["id"]=> string(1) "1" ["name"]=> string(7) "Support" } ["date"]=> string(12) "202004031100" ["file"]=> NULL ["language"]=> string(2) "en" ["unread"]=> bool(false) ["unreadStaff"]=> bool(true) ["closed"]=> bool(false) ["priority"]=> string(3) "low" ["author"]=> array(6) { ["id"]=> string(1) "2" ["name"]=> string(6) "Steven" ["staff"]=> bool(false) ["profilePic"]=> NULL ["email"]=> string(26) "xx" ["customfields"]=> array(0) { } } ["owner"]=> NULL ["events"]=> array(0) { } ["tags"]=> array(0) { } ["edited"]=> NULL ["editedTitle"]=> NULL } } ["customfields"]=> array(0) { } } } Thank you
  3. Thanks for the fast reply! This is the data I get back from a variable dump of return: So I need to be in data -> tickets the rest of the info is irrelevant!
  4. Hello, Having a bit of a tough time understanding what is going on in my brain! I'm basically pulling some data from an API using CuRL, which is working fine. The structure of the data is: [data][tickets] - tickets being an array of support tickets in the system, which then contains ticketNumber, title, content. I want to display these values in a list, I have this code currently: if ($err) { echo "cURL Error #:" . $err; } else { $return = json_decode($response, true); foreach($return as $key) { echo $key["tickets"][1]['ticketNumber']." - "; echo $key["tickets"][1]['title']." - "; echo $key["tickets"][1]['content']; } } Which obviously returns the ticketNumber, title & content of the first support ticket in the array, but I want to loop through and display that information for each ticket! Can anyone advise as to where I am going wrong? I think I need to utilise the ["tickets"][x] but not sure how! Thanks in advance! Steve
  5. Hi all, I used to do quite a bit of PHP coding around 10-12 years ago but grew away from it as it was only ever a hobby! Being kept in, in the UK has drawn me back by helping a friend with his website! I hope we can share knowledge and conquer together! Regards, Steve (UK)
×
×
  • 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.