Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Retrieving only month needed?

Posted on 2001-06-25
5
Medium Priority
?
166 Views
Last Modified: 2006-11-17
I am creating an event calendar and what it to display the current month of events but I would also like to be able to click on a month name (so July for eample) and have a page generated that displays all of Julys events.

What is the best way to store the date (when entering event dates) in order to achieve this?

Also to keep in mind, once June is over, all of Junes old events must be archived.  Either into a mySQL table or into a text file.
0
Comment
Question by:treyjeff
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 2

Accepted Solution

by:
higijj earned 120 total points
ID: 6225154
use MySQL!

let's say your table is as follow:

CREATE TABLE tbl_name (event_name CHAR(20), event_desc CHAR(255), date DATE)


you could select only july event with:

SELECT * FROM tbl_name WHERE MONTH(date) = 6



0
 
LVL 1

Author Comment

by:treyjeff
ID: 6225236
So inserting would be done how?  These dates are entered so they are not always NOW()
0
 
LVL 2

Expert Comment

by:higijj
ID: 6225306
well..

<?
$date = "2001-05-15"; // for may 15th

$link = mysql_connect($SQLHost, $SQLUser, $SQLPassword) OR DIE ("Unable To Connect To Database");
     mysql_select_db($SQLDatabase, $link) OR DIE("Unable To Select To Database");
     $sql="INSERT INTO tbl_name VALUES('$event_name', '$event_desc', '$date')";
     $result = mysql_query($sql);
mysql_close($link);

?>
0
 
LVL 2

Expert Comment

by:higijj
ID: 6225309
you can get the date from a form.. with 3 select (1 for day, 1 for month, 1 for year)
0
 
LVL 2

Expert Comment

by:higijj
ID: 6235767
Thanks!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question