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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:55:49+00:00 2026-05-17T16:55:49+00:00

I don’t know PHP very well, so please bear with me. My client has

  • 0

I don’t know PHP very well, so please bear with me.

My client has a database with information and one of the fields is ff_date_time in the format “Tue Oct 5 14:43:10 2010”. There are a lot of entries in here and I need to display a list of just the days that have entries: ie,

  • Tue Oct 5, 2010
  • Thurs Oct 7, 2010

and so on. There may be hundreds of entries on a certain day, so obviously when I pull in dates from the db I need to go through and extract the right data and filter it. Here’s what I have so far:

$query = "SELECT ff_date_time FROM booth_submit"; 
$query_result = mysql_query($query);
$datetimes = array();
$dates = array();

while ($row = mysql_fetch_array($query_result)) {
  $datetimes[] = $row['ff_date_time'];
}

for ($i = 0; $i < sizeOf($datetimes); $i++) {
  $temp = explode(" ", $datetimes[$i]);
  $dates[] = ($temp[0]." ".$temp[1]." ".$temp[2]." ".$temp[4]);  # Breaks date_time into 'Mon Oct 5 2010' format
}

$dates = array_unique($dates);                      
for ($i = 0; $i < sizeOf($dates); $i++) {
  echo('<a href="#">'.$dates[$i].'</a><br />'); 
}

I’m doing a similar thing for two others fields that work fine, but for some reason, this always yields a $dates array that is the right length (ie: 4 unique dates, array is size 4), but only the first $dates element has any info. The output looks like this:

<a href="#">Mon Oct 3 2010</a><br />
<a href="#"></a><br />
<a href="#"></a><br />
<a href="#"></a><br />

When I don’t use array_unique and just test values to check if everything is getting loaded and parsed correctly, the array is just as it should be (“Mon Oct 3 2010″,”Mon Oct 3 2010″,”Mon Oct 3 2010″,”Mon Oct 4 2010″,”Mon Oct 5 2010″,”Mon Oct 5 2010″,”Mon Oct 6 2010”).

Any clues what’s going wrong here?

  • 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-17T16:55:50+00:00Added an answer on May 17, 2026 at 4:55 pm

    Assign the unique array to another array variable. And use foreach.

    $newarr = array();
    $newarr = array_unique($dates);
    foreach ($newarr as $date) {
      echo('<a href="#">'.$date.'</a><br />' . "\n"); 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.