Jump to content

only show event is day had not passed (hard)


Rifts

Recommended Posts

hey guys

 

so I have this code:

$result = mysql_query("SELECT * FROM pec_mssgs  ORDER BY (y / m) DESC, d ASC");

										while($row = mysql_fetch_array($result))
										  {
										  
										  
												echo "•<a style='text-decoration: underline; font-weight: bold;' href='../index?id=".$row['id']."'>". $row['m']."/".$row['d']."/".$row['y'] . "  -  ".$row['title']."</a>";
												echo "<br /><br />";


										  }

 

in my database instead of doing date I have 3 rows d, m, y, which correlate to day, month, year.

 

now currently its echo out a list and sorting by year then month then day this way the events which are happening soonest will be at top.

 

the problem is it shows events that has already passed.

 

what do I do?

 

It will be way to much work to to back and recode the application to just use date.

 

is there a way I can create a var. using my d/m/y then compare that var. to the current date or something?

 

thanks for the help.

 

It will be much better if you take a single field to database say "date" and its data type should be date,

now store dates in the format of yyyy-mm-dd so you can just directly compare the dates and you can easily sort your record according to date..

 

Thank you

Dheeraj

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.