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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:26:19+00:00 2026-05-28T15:26:19+00:00

I have a call to this php script (only part in question displayed) if

  • 0

I have a call to this php script (only part in question displayed)

if (mysql_num_rows($pquery) == 1) {
   $result = mysql_fetch_assoc($pquery);

   $query_ht = mysql_query("SELECT * FROM coupon WHERE pid='$result[id]'");
   $ht_result = mysql_fetch_array($query_ht); // THIS WILL ALWAYS RETURN 3 ROWS

   //echo json_encode($result); //THis will always contain one row
   //echo json_encode($ht_result); // THIS WILL ALWAYS contain 3 ROWS

UPDATE:

   //echo json_encode(array(
       //'comp' => $result,
       //'ht' => $ht_result)
       // );

This works, but I dont think it is pretty….. Any suggestions

  $query_htl = mysql_query("SELECT * FROM coupon WHERE pid='$result[id]' AND type='L'");
   $query_htg = mysql_query("SELECT * FROM coupon WHERE pid='$result[id]' AND type='G'");
   $query_htr = mysql_query("SELECT * FROM coupon WHERE pid='$result[id]' AND type='R'");
   $ht_resultl = mysql_fetch_assoc($query_htl);
   $ht_resultg = mysql_fetch_assoc($query_htg);
   $ht_resultr = mysql_fetch_assoc($query_htr);
   echo json_encode(array(
       'comp' => $result,
       'htL' => $ht_resultl,
       'htG' => $ht_resultg,
       'htR' => $ht_resultr)
        );

}

When I am echoing one or the other I am ok.. But i do not know how to return everything to jquery

jquery script:

$('#c_search').submit(function(){
       data = ($(this).serialize());

  $.ajax({
      url: 'actions/get_company.php',
      type: 'POST',
      data: data,
      cache: false,
      dataType: 'json',
      success: function(selected){

i can call with:

alert(selected.htL.id);
  • 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-28T15:26:20+00:00Added an answer on May 28, 2026 at 3:26 pm

    Just combine all results in common array:

    header('Content-type: application/json');
    die(json_encode(array(
        'result'    => $result,
        'ht_result' => $ht_result
    )));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php script http://example.com/myapp/myscript.php running on an Apache server. I call this
I have a JavaScript function, pop_item . I have to call this from PHP,
Let's imagine I have a bash script, where I call this: bash -c some_command
I have this PHP script (test.php): <?php $cmd = /usr/bin/sass --watch file1.scss; system($cmd); ?>
Scenario: I have a php page in which I call a python script. Python
I have: $(#option1).live(click, function(){ $(.active).removeClass('active'); $(this).addClass('active'); $(#main).load(option1.php, function(){ }); }); and the script inside
I have a PHP script like this: <?php include 'authorization_script.php'; foreach ($_POST as $key
I have identified this call as a bottleneck in a high pressure function. graphics.DrawImage(smallBitmap,
i have a snippet call like this: [!mysnippet?&content=`[*content*]` !] What happen is that, if
Would you call this implementation of a multiton in objective-c 'elegant'? I have programmatically

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.