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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:32:54+00:00 2026-05-30T17:32:54+00:00

I am doing SQL query in ASP page, and getting a 100 rows and

  • 0

I am doing SQL query in ASP page, and getting a 100 rows and 7 columns of data.

For example, I read from the query string in my URL or the form I submitted as POST / GET,

I got this: ” myexample.com/order.php?month=2012-03 “, I use the ” 2012-03 ” as my value in ASP page to run a query ” SELECT * FROM CustomerSalesOrder WHERE date LIKE '2012-03%' “

Now, as above mentioned, I got 100 rows with 7 columns of data about my customers purchase what in March.

How to convert these data into an array and passing to a PHP page to generate table with data display on the table ?

(I understand that I can run everything in 1 web programming language. But the step to run query in ASP page has been fixed, can not be changing; and the step to display data on PHP page also fixed. ASP page located in myexample.com, while PHP page located in mywork.com)

Please guide me the step-by-step of:

  • dump my data into array in ASP page, and
  • how to pass my data (in array form) to PHP page to display data in a proper formatted table form

I expect the expert to guides me the data converting into array in ASP, and the step of array passing to PHP page.

Then, in PHP page, how to explode every data in array or assign the data to value for variable? (I guess need to be using looping, any loop method is the best in this case?) Once I got the value either in looping or another way, then loop again into table.

  • 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-30T17:32:56+00:00Added an answer on May 30, 2026 at 5:32 pm

    May i suggest that your asp page outputs the “Array” of SQL Data as XML, and the PHP page just reads the XML (Using CURL) and parses the XML into a php array?

    Outputting SQL Data as XML:

    ''#### Build SQL Query to grab data as XML (you may want to put this in a stored procedure
    dim SqlStr
    SqlStr = "SELECT CONVERT(VARCHAR(MAX), ( SELECT [ColA] AS 'A', [ColB] AS 'B', [ColC] AS 'C', [ColD] AS 'D', [ColE] AS 'E', [ColF] AS 'F', [ColG] AS 'G'" & _
             "                 FROM    CustomerSalesOrder " & _
             "                 WHERE [Date] LIKE '2012-03%' " & _
             "               FOR " & _
             "                 XML PATH('R') , " & _
             "                     ROOT('ROOT') " & _
             "               )) as XML"
    
    set rs = db.execute(SqlStr)
    
    do while not rs.eof
        XmlStr = rs("XML")
        rs.movenext
    loop
    
    ''#### XML Headers
    Response.CacheControl = "no-cache"
    Response.AddHeader "Pragma", "no-cache"
    Response.Expires = -1
    Response.ContentType = "text/xml"
    Response.Write "<?xml version='1.0' encoding='utf-8'?>"
    Response.Write XmlStr
    

    The PHP page could read this as follows:

    $URL = "URL to the ASP page";
    $ch  = curl_init();
    curl_setopt($ch, CURLOPT_URL, $URL);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
    $output = trim(curl_exec($ch));
    $xml = simplexml_load_string($output);
    
    //#### Prep Array
    var $TargetArray[];
    $ArrayPointer = 0;
    
    //#### Parse XML
    foreach($xml->children() as $child) {
        $ColA = trim($child->A);
        $ColB = trim($child->B);
        $ColC = trim($child->C);
        $ColD = trim($child->D);
        $ColE = trim($child->E);
        $ColF = trim($child->F);
        $ColG = trim($child->G);
    
        //#### Push values into your array (This may be buggy, my php & multi dimensional arrays is a tad rusty)
        $row = array('ColA' => $ColA, 'ColB' => $ColB, 'ColC' => $ColC, 'ColD' => $ColD, 'ColE' => $ColE, 'ColF' => $ColF, 'ColG' => $ColG); 
        $TargetArray[$ArrayPointer] = $data;
        $ArrayPointer++;
    }
    

    Alternatively, if you just want to squirt the CURL XML into a HTML table, you could do this as follows:

    //#### Parse XML from CURL into HTML Table
    echo "<table>";
    echo "<tr>";
    echo "  <th>ColA</th>";
    echo "  <th>ColB</th>";
    echo "  <th>ColC</th>";
    echo "  <th>ColD</th>";
    echo "  <th>ColE</th>";
    echo "  <th>ColF</th>";
    echo "  <th>ColG</th>";
    echo "</tr>";
    foreach($xml->children() as $child) { 
        echo "<tr>";
        echo "  <th>" . trim($child->A) . "</th>";
        echo "  <th>" . trim($child->B) . "</th>";
        echo "  <th>" . trim($child->C) . "</th>";
        echo "  <th>" . trim($child->D) . "</th>";
        echo "  <th>" . trim($child->E) . "</th>";
        echo "  <th>" . trim($child->F) . "</th>";
        echo "  <th>" . trim($child->G) . "</th>";
        echo "</tr>";
    }
    echo "</table>";
    

    I’m sure this will require some tweaking, but it should be enough to get you going with the both the PHP & ASP side of it.

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

Sidebar

Related Questions

I am getting strange results from a query using XML EXPLICIT mode in T-SQL
I currently have an asp.net page, that takes in the data from this view
I'm doing update data into SQL Server in ASP.Net. and I only have a
I am using a codebehind page in ASP.NET to perform a SQL query. The
There is a certain query that is being called from an ASP .NET page.
Are they less vulnerable to SQL injection than doing stuff like mysql_query(SELECT important_data FROM
Last few days I was doing some SQL connected with ASP.NET stuff and whole
Summary We have an ASP.NET application that allows users to query a SQL Server
I have a result from an SQL query that I would like to sort
first time I'm doing an insert from ASP.NET/C# and I'm having a little issue.

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.