Jump to content

Showing event this month only


pemula

Recommended Posts

My db:

 

CREATE TABLE `tb_event` (

  `id` tinyint(4) NOT NULL auto_increment,

  `t_date` date default NULL,

  `t_event` varchar(75) default NULL,

  `t_place` varchar(75) default NULL,

  `t_content` text,

  PRIMARY KEY  (`id`)

)

 

Records:

1, '2011-01-09', 'event 1', ...

2, '2011-05-12', 'event 2', ...

3, '2011-09-20', 'event 3', ...

 

-------

 

My code here:

 

<?

$now = date("Y-m-d");

...

...

SELECT * FROM tb_acara WHERE t_tanggal >= $now

...

...

?>

 

It will show all records.. :(

I change >= with <= it didn't show anything

 

-------

 

My goal is:

I only want to show the event which in September (month of 9) on record number 3

 

Can you help me please guys??

Thanks

 

Link to comment
Share on other sites

You are confusing me, you are creating table 'tb_event'

but... you are querying table 'tb_acara'.....

 

Assuming that your query is against table 'tb_event' this what I would do to retrieve September events:

 

$sql = "SELECT * FROM tb_event WHERE MONTH(t_date)=9";

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.