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 7718843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:16:02+00:00 2026-06-01T03:16:02+00:00

I am using php to talk to a mysql database then encoding the associative

  • 0

I am using php to talk to a mysql database then encoding the associative array with json_encode. That much I know is working, I can call the php directly and see the json result.

With jQuery I am using onChange on a dropdown to call the php function and to get the results.

I think I have problems with the jQuery and json, but I have looked through multiple posts and cannot find a good answer.

Here is the code I am using. How do I get to the json array? I have tried data[‘ele’], data.ele, data[0] and all return undefined.

$('#itemDD').change(function(data){
      alert("Changing");
      askServer(function(data){
        alert("!" + data['retailListPrice']);
       //spin through the data and put the results in workingQuote
      });   
    });

function askServer(callback)
{
   var selItem = $('#itemDD').val();
   var strUrl = "getItemList.php?item=" + selItem + "&action=itemInfo";
   alert(strUrl);
    jQuery.ajax({
       url:strUrl, 
       success:callback, 
       dataType: "json" 
    });
}

 });

PHP

$sql="SELECT *
              FROM items
              WHERE modelNum='" . $selectedModel . "'";
        $result = mysql_query($sql,$conn) or die("Error" . mysql_error());

        while(($resultArray[] = mysql_fetch_assoc($result)) || array_pop($resultArray));
        echo json_encode($resultArray);
  • 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-06-01T03:16:03+00:00Added an answer on June 1, 2026 at 3:16 am

    You using array and mysql_fetch_assoc. So to get the data, use data[0][‘rowName’] or data[0].rowName

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

Sidebar

Related Questions

Using PHP, I can convert MySQL data or static table data to csv, Excel,
Using PHP and MySQL, I have a forum system I'm trying to build. What
using php and mysql I have two tables, a users table and a profiles
Using PHP and MySQL, I am integrating a site with a wiki based on
Using PHP's Image and GD functions you can use the following method to finally
I am trying to display my events from a MySQL database. I'm using the
Currently I am using MySQLi to parse a CSV file into a Database, that
How does Google Talk get the current song played? Can I do this using
I'm using PHP to talk with a Mongo use findOne($query) on a db.collection it
When using the following interface to talk to PHP from .NET, .NET builds 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.