Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Retrieving only month needed?

Posted on 2001-06-25
5
Medium Priority
?
169 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 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

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses four methods for overlaying images in a container on a web page
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…
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.
Suggested Courses

916 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