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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:47:18+00:00 2026-06-07T05:47:18+00:00

$result = mysql_query (SELECT * FROM order_list); $test = array(); $i=0; $myjsons = array();

  • 0
$result = mysql_query ("SELECT * FROM order_list");

$test = array();
$i=0;

$myjsons = array();
while($row = mysql_fetch_assoc($result)){ 
    echo $myjsons[] = json_encode(array($row));
}

and a AJAX javascript

function ajaxFunction() {
    var ajaxRequest; // The variable that makes Ajax possible!
    try {
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    } catch (e) {
        // Internet Explorer Browsers
        try {
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                // Something went wrong
                alert("Your browser is too old to run me!");
                return false;
            }
        }
    }
    // Create a function that will receive data sent from the server
    ajaxRequest.onreadystatechange = function() {
        if (ajaxRequest.readyState == 4) {
            document.getElementById("resultTXT").value = eval("    (" + ajaxRequest.responseText + ")");
        }
    }
    ajaxRequest.open("POST", "userfind.php", true);
    ajaxRequest.send(null);
}​

the javascript function wont store the array into the textbox

can anyone tell me whats the problem here?

Thanks

  • 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-07T05:47:19+00:00Added an answer on June 7, 2026 at 5:47 am

    try:

     while($row = mysql_fetch_assoc($result)){ 
         $myjsons[] = json_encode(array($row));
        }
     echo json_encode($myjsons);
    

    instead of

    while($row = mysql_fetch_assoc($result)){ 
      echo $myjsons[] = json_encode(array($row));
    }
    

    you can use jquery library for tha ajax call http://api.jquery.com/jQuery.post/

    $.post('userfind.php', function(data) {
       $("#resultTXT").val(data);// ==document.getElementById("resultTXT").value =data;
    },'json'
    
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use ajax to run MySQL query and echo json_encode result, so that I
Here's what I've got so far- $awards_sql_1 = mysql_query('SELECT * FROM categories WHERE section_id
I'm trying to insert variables from an SQL result into a HTML form in
I am outputing a simple list of options from dynamic select menus using Codeigniter/MYSQL.
The MySQL query: SELECT title,alias,parent FROM '._prefix.'categories WHERE (language = \''._language.'\' || language =
The original query looks like this (MySQL): SELECT * FROM books WHERE title LIKE
How do I store a MySQL query result into a local CSV file? I
Mysql query returns result like this collector amount name 1 0.00 gihan 1 2000.00
I have a php script that runs a mysql query, then loops the result,
Normally when I want to query large result set using Mysql I write this

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.