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
Solved

Retrieving only month needed?

Posted on 2001-06-25
5
159 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
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

828 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