Jump to content

help with displaying variables


imarockstar

Recommended Posts

I need to choose the date from a mysql DB and display them using PHP ... my problem is that in the DB the date fields are in this format  MONTH . DAY . YEAR .. so basically there is a column for the month for the day and for the year.

 

I need to choose a row based on the date ... but since they are in 2 different columns ... I am not sure how to do that ..

 

this is what I am using now ...

 

$result = mysql_query("SELECT * FROM shows where month < '5' && userid = ". $_SESSION['id']); 
$showsplayed = mysql_num_rows($result);

 

right now I am selecting the row based on the MONTH only ... but i need to select the row that has the date that is before TODAYS (current date) date ...

 

So i would think I would need t join all 3 columns .. then choose it ?

 

Then I would just echo the data in that row ...

 

 

im soo confused lol ... any help would be awesome ..

 

Link to comment
https://forums.phpfreaks.com/topic/157726-help-with-displaying-variables/
Share on other sites

You need to properly store your dates using MySQL's DATE column type.  You can use STR_TO_DATE() to fix this with a single update statement, and also use this function to format your form input (though a proper date picker won't have this issue whatsoever).

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.