Jump to content

Recommended Posts

Hi,

 

 

 

When visitor enter some text in Form I put the (expire) datetime too into dBase like: 20081010

 

Mysql table is:

 

id

text (TEXT)

date_expire (INT) 00000000

datetime (DATETIME) 0000-00-00 00:00:00

 

in table is `date_expire` Date of expire is equal with a date when put the text into dBase.

 

$query_return = mysql_query( "SELECT * FROM `text` WHERE `date_expire` ... " );

 

SO, I want to visitors see the text only 15 days. As I see I must convert the date_expire into date and... ??? :(

 

How can the visitor see the text 15 days from date given in date_expire to next 15 days?

 

thxs in advanced.

 

T

Link to comment
https://forums.phpfreaks.com/topic/127814-solved-convert-nr-to-date/
Share on other sites

look up interval mysql mate...........

 

Hm... is that mean that I can use the datetime (DATETIME) 0000-00-00 00:00:00, and...

 

$query_return = mysql_query( "SELECT * FROM `text` WHERE `datetime` ... " );

 

Sorry, Im not a best in PHP (and MySQL), so I dont understand clarly...

hi, thank You all of You for associations, here is the solution for my problem:

 

$query_return = mysql_query( "SELECT * FROM `table` WHERE  DATE_ADD(`datetime`, INTERVAL 15 DAY) >= '".date("Y-m-d H:i:s")."' ");

 

In lots of time enough to tell me what do I search on internet for a solution :)

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.