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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:05:04+00:00 2026-06-18T11:05:04+00:00

Hi I found this question here , but it doesnt do exactly what i’m

  • 0

Hi I found this question here
, but it doesnt do exactly what i’m looking for.

I would like the table to be displayed like this instead:

   **     | array1         | array2 
           -------------------------------
 logtime   | 1305732210     | 1305732216
           -------------------------------
 useragent | Mozilla        | Mozilla
           -------------------------------

Edited:

my bad for not posting code, but here is what i’m stuck on.

i have this query that outputs an array of data from mysql

SELECT s.*, m.id AS wmMake
                                  FROM `table1` AS s
                                  JOIN `table2` AS m
                                  WHERE s.code = m.code
            AND (s.ic='123'
            OR s.ic='1234"

its output looks like this

Array ( [0] => PAS [cat] => PAS [1] => H4B12A [ic] => H4B12A [2] => SMALL [segment] => SMALL [3] => 6 [wmMake] => 6 ) 
Array ( [0] => PAS [cat] => PAS [1] => HUV12A [ic] => HUV12A [2] => SMALL [segment] => SMALL [3] => 6 [wmMake] => 6 )

Now on my php side i have this:

for ($i =0; $c = mysql_fetch_array($query); $i++)
{
   print_r($c); 
}

the for loop, loops through 1 row at a time, how do i loop through each row, and get the 1st value and, then each row again to get 2nd value of array and so on. My html output should look like this.

    **     | array1         | array2 
           -------------------------------
 cat       | PAS            | PAS
           -------------------------------
 ic        | H4B12A         | HUV12A
           -------------------------------
 segment   | SMALL          | SMALL
           -------------------------------
  wmMake   | 6              | 6
  • 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-18T11:05:06+00:00Added an answer on June 18, 2026 at 11:05 am

    Get the array keys first. And then loop through the keys and echo the values from both the arrays.

    $keys = array_keys($arr1, $arr2);
    
    echo "<table>";
    foreach($keys as $k) {
        echo "<tr>";
        echo "<td>".$k."</td>";
        echo "<td>".$arr1[$k]."</td>";
        echo "<td>".$arr2[$k]."</td>";
        echo "</tr>";
    }
    echo "</table>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found this similar question here , but this is really old. Was it
I can't resolve this issue, I found a similar question here but: setting the
Searching here I found that this question was already asked , but I think
First, I know this question doesn't exactly belong here, but I'll explain later why
I've seen this question asked here but I haven't found one that is answered
I've found some questions here about this topic, but none of the solutions solve
I found a few questions similar to this one here on SO, but none
I haven't found this question, feel free to close if it's already up here.
I found this on Google, click here , which someone asked a similar question,
The title is my question. I already found a topic related to this here

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.