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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:18:57+00:00 2026-05-31T19:18:57+00:00

I got 3 arrays in PHP 1. Place name – $places 2. Days spent

  • 0

I got 3 arrays in PHP
1. Place name – $places
2. Days spent in each place – $days
3. Hours spent in each place – $hours

For eg

$places=array(15,12,10,2,78,32);
$days=array(1,0,5,4,3,8);
$hours=array(0,12,8,9,0,14);

For places I am keeping places id

My actual worry is I need to sort places array according to alphabetic order of place name ( which is from database )

like

$ids=implode(',',$places);
$res=mysql_query("select * from places where WHERE id IN ($ids) ORDER BY name ASC");



while($row=mysql_fetch_array($res)){



echo $row['name']. 'Days Spent ' . $days . 'Hours : '.$hours ; 

}

My doubt is simple , I have to show days & hours spent in each places in this MySQL result , ie after sorted/ order by MySQL query ..

Please help ,
Thank you for your time

  • 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-31T19:18:58+00:00Added an answer on May 31, 2026 at 7:18 pm

    In your loop:

    $key = array_search($row['id'], $places);
    echo $days[$key];
    echo $hours[$key];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a php array (obtained through checkbox values in a form - as
I've got a large number of integer arrays. Each one has a few thousand
I have got my self confused on how to construct arrays correctly in PHP
I've got an array with nested arrays, and I was trying to use the
I have two PHP arrays. One contains a group name and another contains a
Does C# got an way of using objects as normal arrays? Like PHP does
I've got a PHP array in this format: $js_data_array[] = array('href' =>$matches[1][0], //this is
I've got two arrays of the same size. I'd like to merge the two
I've got two arrays where I want to find all the elements in Array0
I've got a class with many string arrays. I'd like to have one generic

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.