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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:49:42+00:00 2026-06-10T18:49:42+00:00

PHP $table = mysql_real_escape_string($_REQUEST[‘table’]); $query = SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.Columns where TABLE_NAME = ‘$table’;

  • 0

PHP

$table = mysql_real_escape_string($_REQUEST['table']);

$query  = "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.Columns where TABLE_NAME = '$table'";
$result = mysql_query($query);
$arr1 = array();
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    $arr1[] = $row['COLUMN_NAME'];
}
echo json_encode($arr1);

}

Javascript/Jquery

$("#verticalSelect").change(function() {
    var table = $("#verticalSelect option:selected").attr('value');

    $.post(PROCESSORFILE, {"task": "getTableDupeFields", "table": table}, function(data) {
        $.each(data, function(key, value){
            $("#test-area").append(key+' is: '+value+'<br/>');
        });
        alert(data);
    });
});

Now with the alert of the returned JSON variable I get the result I expect.

["lead_id", "callcenter", "monkey" ...]

But with the Jquery.each() function I get this:

0:is: [
1:is: “
2:is: l
3:is: e
4:is: a
5:is: d
6:is: _
7:is: i
8:is: d
9:is: “
10:is: ,
11:is: “
12:is: c
13:is: a
14:is: l
15:is: l
16:is: c
17:is: e
18:is: n
19:is: t
20:is: e
21:is: r

Every character of the returned array is looped instead of every discreet value. What is the proper way of handling JSON returned arrays?

  • 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-10T18:49:44+00:00Added an answer on June 10, 2026 at 6:49 pm

    You either need to set your response header to application/json or specify the dataType in $.post to be ‘json’

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

Sidebar

Related Questions

<?php include db.php; $username=$_POST['username']; $email=$_POST['email']; $query=SELECT * FROM members where username = '.mysql_real_escape_string($username).'; $result=mysql_query($query)or
Using PHP and MySQL, I want to select only 6 rows from table which
The PHP file: <? print_r($_REQUEST); $thispage = 'login'; require('db.php'); if($_POST['admin_username'] && $_POST['admin_password']) { $query=SELECT
When showing data from a mysql table on an php page does it have
I have a PHP/MySQL query that returns to an HTML table, and I'm stuck
Possible Duplicate: outputting values from database into html table PHP I am trying to
Why does PHP store characters such as Japanese in MySQL table that supports utf8
What is the php script for converting a mysql table to text file? I
I am trying to create a table in MySql using php. My code looks
i work with php/Mysql i have table with two cols (date , cash) with

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.