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

  • Home
  • SEARCH
  • 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 6722483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:27:10+00:00 2026-05-26T09:27:10+00:00

In my php file I have $data = array(); while ($row = mysql_fetch_array($result, true))

  • 0

In my php file I have

$data = array();  
while ($row = mysql_fetch_array($result, true))   
{$data[] = $row;};  
echo json_encode($data);

It produces the JSON array:

[
    {
        "record_id": "4",
        "eq_type_id": "999",
        "scidiv_id_tag": "AKINS04",
        "date_last_updated": "2011-07-11 14:41:58",
        "description": "Optics Table D",
        "eq_type_desc": "Other Equipment Type"
    }
]

In my JQUERY script:

$.ajax(
{
    type: "GET",
    //dataType: "json",
    url: "../scidiv/php/editData.php",
    data: "recid=" + scidivtag,
    success: function(data)
    {
       $('#output1').html(data);
       $('#output').html("<b>id: </b>"+ data[0].record_id + "<b> name: </b>" +data[1].eq_type_id); 
     }

});

$('#output1').html(data); displays the above array on my web page....

But both

$('#output').html("Record Id: "+ data.record_id+"Eq Type ID: "+ data.eq_type_id);  

an

$('#output').html("Record Id: "+ data[0].record_id+"Eq Type ID: "+ data[1].eq_type_id);

Gives me

id: undefined name: undefined

Can someone tell me what I’m missing??

Thanks
Chris

  • 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-26T09:27:10+00:00Added an answer on May 26, 2026 at 9:27 am

    Thanks for all the assistance and suggestions…

    I solved the problem by re-writing my php script from scratch…
    The main thing I did was get the results of the query as a simple array since I’m getting only one row of data the query:

    $jqdata = mysql_fetch_row($result,);   
    echo json_encode($jqdata);
    

    So my json looks like:

    ["7","1","999","AKINS01","2011-07-11 14:39:22","Optics Table A","Other Equipment Type"] 
    

    Thanks again!!

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

Sidebar

Related Questions

i have a json data retrieved from data base i.e $result=array(); $query=SELECT * FROM
First I have a PHP file that gets data and file from a HTML
I have an upload box... <form action=upload_file.php method=post enctype=multipart/form-data><BR> <label for=file>Filename:</label><BR> <input type=file name=file
I have a PHP file, Test.php, and it has two functions: <?php echo displayInfo();
I have this file 'gardens.php' , which pulls data from a table called 'generalinfo'
I have two files, one containing an array in PHP that is echo ed
I have a php file which fetch and print data from my mysql table.
In php I have open a .php file and want to evaluate certain lines.
I have an index.php file which has to process many different file types. How
i have a php file launching my exe. the exe does cout and the

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.