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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:57:43+00:00 2026-05-29T20:57:43+00:00

First the data: CREATE TABLE IF NOT EXISTS `calendar_events` ( `event_id` int(5) unsigned NOT

  • 0

First the data:

CREATE TABLE IF NOT EXISTS `calendar_events` (
`event_id` int(5) unsigned NOT NULL AUTO_INCREMENT,
`event_day` date DEFAULT NULL,
`event_day_to` date DEFAULT NULL,
`event_year` int(4) NOT NULL DEFAULT '0',
`event_time` varchar(7) NOT NULL DEFAULT '',
`event_time_to` varchar(7) DEFAULT NULL,
`event_title` varchar(200) NOT NULL DEFAULT '',
`event_desc` text NOT NULL,
`event_type` varchar(2) DEFAULT NULL,
PRIMARY KEY (`event_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;

--
-- Dumping data for table `calendar_events`
--

INSERT INTO `calendar_events` (`event_id`, `event_day`, `event_day_to`,    `event_year`, `event_time`, `event_time_to`, `event_title`, `event_desc`, `event_type`) 
VALUES
(8, '2012-02-10', '2012-02-10', 0, '', NULL, 'Feb 10', '', NULL),
(5, '2012-02-21', '2012-02-23', 0, '', NULL, '21-23 range addition', '', NULL),
(4, '2012-02-15', '2012-02-18', 0, '', NULL, 'Febbb 18', 'Some stuff here as a description', NULL),
(7, '2012-02-12', '2012-02-12', 0, '', NULL, 'single date 12', '', NULL),
(9, '2012-02-28', '2012-02-28', 0, '', NULL, 'test 28Date', '', NULL),
(10, '2012-02-01', '2012-02-01', 0, '', NULL, 'feb1', '', NULL);

Query that makes the values available:

mysql_select_db($database_MySQLconn, $MySQLconn);
$query_rsDates = "SELECT calendar_events.event_day, calendar_events.event_id, calendar_events.event_title, calendar_events.event_desc, calendar_events.event_day_to FROM calendar_events";
$rsDates = mysql_query($query_rsDates, $MySQLconn) or die(mysql_error());
$row_rsDates = mysql_fetch_assoc($rsDates);
$totalRows_rsDates = mysql_num_rows($rsDates);

Next the code setting the values to an array:

$dates = array();


while ($row_rsDates = mysql_fetch_assoc($rsDates))
{

for($start_date = strtotime($row_rsDates['event_day']);
$start_date <= strtotime($row_rsDates['event_day_to']);
$start_date = $start_date + 24*3600)

{
$row_rsDates['event_day'] = date("Y-n-j", $start_date);
$dates[] = $row_rsDates;
}
}

echo json_encode($dates);

Resulting JSON:

[{"event_day":"2012-2-21","event_id":"5","event_title":"21-23 range addition","event_desc":"","event_day_to":"2012-02-23"},{"event_day":"2012-2-22","event_id":"5","event_title":"21-23 range addition","event_desc":"","event_day_to":"2012-02-23"},{"event_day":"2012-2-23","event_id":"5","event_title":"21-23 range addition","event_desc":"","event_day_to":"2012-02-23"},{"event_day":"2012-2-15","event_id":"4","event_title":"Febbb 18","event_desc":"Some stuff here as a description","event_day_to":"2012-02-18"},{"event_day":"2012-2-16","event_id":"4","event_title":"Febbb 18","event_desc":"Some stuff here as a description","event_day_to":"2012-02-18"},{"event_day":"2012-2-17","event_id":"4","event_title":"Febbb 18","event_desc":"Some stuff here as a description","event_day_to":"2012-02-18"},{"event_day":"2012-2-18","event_id":"4","event_title":"Febbb 18","event_desc":"Some stuff here as a description","event_day_to":"2012-02-18"},{"event_day":"2012-2-12","event_id":"7","event_title":"single date 12","event_desc":"","event_day_to":"2012-02-12"},{"event_day":"2012-2-28","event_id":"9","event_title":"test 28Date","event_desc":"","event_day_to":"2012-02-28"},{"event_day":"2012-2-1","event_id":"10","event_title":"feb1","event_desc":"","event_day_to":"2012-02-01"}]

The 10th of Feb does not show…
I can add a new single date (same start and end date) and these work perfectly. I can remove the 10th of Feb and reinsert it as a new record but it still fails to show…

Now let’s print_r the current array:

Array
(
[0] => Array
(
[event_day] => 2012-2-21
[event_id] => 5
[event_title] => 21-23 range addition
[event_desc] =>
[event_day_to] => 2012-02-23
)

[1] => Array
(
[event_day] => 2012-2-22
[event_id] => 5
[event_title] => 21-23 range addition
[event_desc] =>
[event_day_to] => 2012-02-23
)

[2] => Array
(
[event_day] => 2012-2-23
[event_id] => 5
[event_title] => 21-23 range addition
[event_desc] =>
[event_day_to] => 2012-02-23
)

[3] => Array
(
[event_day] => 2012-2-15
[event_id] => 4
[event_title] => Febbb 18
[event_desc] => Some stuff here as a description
[event_day_to] => 2012-02-18
)

[4] => Array
(
[event_day] => 2012-2-16
[event_id] => 4
[event_title] => Febbb 18
[event_desc] => Some stuff here as a description
[event_day_to] => 2012-02-18
)

[5] => Array
(
[event_day] => 2012-2-17
[event_id] => 4
[event_title] => Febbb 18
[event_desc] => Some stuff here as a description
[event_day_to] => 2012-02-18
)

[6] => Array
(
[event_day] => 2012-2-18
[event_id] => 4
[event_title] => Feb 18 single date
[event_desc] => Some stuff here as a description
[event_day_to] => 2012-02-18
)

[7] => Array
(
[event_day] => 2012-2-12
[event_id] => 7
[event_title] => single date 12
[event_desc] =>
[event_day_to] => 2012-02-12
)

[8] => Array
(
[event_day] => 2012-2-28
[event_id] => 9
[event_title] => test 28Date
[event_desc] =>
[event_day_to] => 2012-02-28
)

[9] => Array
(
[event_day] => 2012-2-1
[event_id] => 10
[event_title] => feb1
[event_desc] =>
[event_day_to] => 2012-02-01
)

)

The mysterious 10th of Feb is nowhere to be found…

Why would this one date not work as the others? There is other single date events such as Feb 1st through Feb 1st so that is not the problem. And, if the Feb 10th date is added again as a second record (new event_id of course) this new record is added to the array without issue.

Why will the first record containing Feb 10th not be processed to the array?

  • 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-29T20:57:44+00:00Added an answer on May 29, 2026 at 8:57 pm

    By calling

    $row_rsDates = mysql_fetch_assoc($rsDates);
    

    before the while loop, you remove the first row. Just drop that line and things will be ok.

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

Sidebar

Related Questions

Please dump these data first CREATE TABLE IF NOT EXISTS `all_tag_relations` ( `id_tag_rel` int(10)
First execute these tables and data dumps :- CREATE TABLE IF NOT EXISTS `Tags`
I have this table: CREATE TABLE IF NOT EXISTS `events` ( `evt_id` int(11) NOT
I'm trying to create my first data mart. I am creating my dimension table
This is my table CREATE TABLE IF NOT EXISTS `results_stock_all` ( `Result_Id` varchar(50) NOT
I'm storing linked lists of data in records that look like this: CREATE TABLE
I've created a table with a primary key and enabled AUTO_INCREMENT : CREATE TABLE
When I first load data into a Silverlight DataGrid control, how can I make
I'm working on my first Core Data project (on iPhone) and am really liking
I have a custom image file where the first block of data is ASCII

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.