Solved

Retrieving only month needed?

Posted on 2001-06-25
5
149 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
  • 4
5 Comments
 
LVL 2

Accepted Solution

by:
higijj earned 30 total points
Comment Utility
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
Comment Utility
So inserting would be done how?  These dates are entered so they are not always NOW()
0
 
LVL 2

Expert Comment

by:higijj
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…

728 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now