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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:47:23+00:00 2026-06-05T23:47:23+00:00

I want to echo out each date in my Array within a PHP file.

  • 0

I want to echo out each date in my Array within a PHP file. Right now my code is

foreach ($result_array as $date) {
   echo $date;
}

which results in

ArrayArrayArrayArrayArrayArray

How can I modify my code to show each date rather then Array?

EDIT

I’m building the array like so…

    $result_array =  array();
    $result_set = mysql_query("SELECT DISTINCT `saledate` FROM `phoneappdetail` WHERE salebarn = 'OSI'");

    while ( $row = mysql_fetch_array($result_set) ) {
        $result_array[] = $row;
    }
  • 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-05T23:47:26+00:00Added an answer on June 5, 2026 at 11:47 pm

    It prints Array because $date is array, modify your script like this:

    foreach ($result_array as $date) {
       echo $date['saledate'];
    }
    

    Read more on how mysql_fetch_array works, it returns array (indexed, associative or both), so you need to choose which field you want to use.

    Note from manual:

    Use of this extension is discouraged. Instead, the MySQLi or PDO_MySQL
    extension should be used. See also MySQL: choosing an API guide and
    related FAQ for more information. Alternatives to this function
    include:

    mysqli_fetch_array()

    PDOStatement::fetch()

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

Sidebar

Related Questions

How can I echo out the count of within a foreach loop? I want
in Php, I want to print Düsseldorf using echo 'Düsseldorf'; However it turns out
I want to use echo to add data into a text file progressively. I
I want to issue the echo command inside a c++ file. All i need
I want to run an audio file through something like skype's echo cancellation feature.
We want to figure out if a file on a Windows system has been
What is the problem with following code? Please help me out. I want to
Still trying to figure out date with PHP. I have this: $fri_end_date = date('Y-m-d',strtotime('Friday'));
<?php wp_nav_menu(); ?> So I want to use the above function to spit out
I want to use the constants.php file to store common image locations. I have

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.