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
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).

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.