Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 952139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:50:40+00:00 2026-05-15T23:50:40+00:00

Sorry for asking a basic question like this but I’ve been reading on this

  • 0

Sorry for asking a basic question like this but I’ve been reading on this for a few hours now and the examples aren’t making sense to me in context of the way my array is.. I have been able to pass this from my server side (cakephp) to the javascript (I’m using jquery) but after that, I am lost as to how to make use of the data.. I tried just showing it using an alert, but it gives output like “object Object” and thats all..

This is an example array that I have:

    Array ( 

    [0] => Array ( [Uiemail] => Array ( [uiemail_id] => 2 [divid] => upd1 [width] => 200 [height] => 200 [leftpos] => 122 [toppos] => 122 [cssgroup] => 1 [colortop] => [colorbottom] => [colorborder] => [borderwidth] => [zindex] => ) ) 

    [1] => Array ( [Uiemail] => Array ( [uiemail_id] => 3 [divid] => upd2 [width] => 200 [height] => 200 [leftpos] => 333 [toppos] => 444 [cssgroup] => 1 [colortop] => [colorbottom] => [colorborder] => [borderwidth] => [zindex] => ) ) 

    [2] => Array ( [Uiemail] => Array ( [uiemail_id] => 4 [divid] => upd3 [width] => 200 [height] => 200 [leftpos] => 555 [toppos] => 466 [cssgroup] => 1 [colortop] => [colorbottom] => [colorborder] => [borderwidth] => [zindex] => ) ) 

) 

EDIT:

The array is the way it is as its the output from a Cakephp database GET (cakephp’s equivalent of this).

It has 3 arrays, the first is the “parent array” and contains the [1], [2], [3] which are like an auto-increment ID for the 2nd tier arrays.

The 2nd tier has an array that holds the 3rd, this second doesn’t really contain any data other than the 3rd array (its done like this by cakephp since its representing the database table)

So, the 3rd tier array has all the data that I need, however I also would want to use the first tier ID

IN PHP A INDIVIDUAL PIECE OF DATA FROM THIS ARRAY IS ACCESSED AS SUCH:

$arrayline = [0]['Uiemail']['toppos'];

Here is some javascript I tried that didn’t work (json is array name):

    $(json).each(function() {
      alert(this.text)
    });
});

Thanks for any advice, its just that my array is a nested array (as its from a database call) and it seems most examples don’t go this deep which is leading me to confusion.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T23:50:41+00:00Added an answer on May 15, 2026 at 11:50 pm

    An ‘associative array’ in PHP (i.e. with meaningful keys like your ‘uiemail_id’ will become an object in JSON notation. Even an array that is not exactly 0-indexed & continuous will also become one. (i.e. an array with keys 0,1,2 will result in an array, keys 1,2,3 or 0,2,3 will result in an object.

    If you access a value in PHP like this:

    $arrayline = $array[0]['Uiemail']['toppos'];
    

    The access on the resulting structure in js would be:

    arrayline = jsonvar[0].Uiemail.toppos;
    

    Enabing firebug in firefox, with breakpoints, lets you easily inspect any variable available at that moment at your leisure, which makes it a far easier to debug then the usual default PHP way of just dumping variable notation to stdout (i.e. printr / var_dump‘s).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry for asking such a general question but this has been bugging me for
Sorry for asking such a basic question but so far all the examples that
Sorry for asking a totally basic question, but if I have a synthesized property
Sorry for asking this question, but I searched all Java-related questions, but I got
I am learning Haskell. I'm sorry for asking a very basic question but I
sorry for asking this question again but i didnt get much help on the
This might seem like a silly question, but after asking some questions on stackoverflow
Sorry for asking very basic question. I would like to set OR condition in
Sorry for asking about quite the same issue, but now i would like to:
Sorry for asking probably a basic question, but I'm having a blackout. If I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.