Jump to content

Archived

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

cabothug

help with a school project

Recommended Posts

hi everyone,

can someone please help me??

i have a school project that i have to make
the purpose is to make an bookstore with php and xhtml,
i have make the template and the sql database and some easy query's
but now i am stuck with the more complexer php and sql jobs

the problem is. an costumer must be able to make an booking on a book and then that book is then not for sale more
de booking expire after 10 days.
de sales guy has an overview with al expired bookings and can determine wich it like to erase
after a erase of a booking the book is available for sale

if someone can help me with one of this topics i would realy appreciate that

Share this post


Link to post
Share on other sites
Create a field called "date", with a UNIX timestamp containing the date when the booking was made.

Then, to find out which bookings should be expired, query for:

[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] * [color=green]FROM[/color] [color=orange]table[/color] [color=green]WHERE[/color] date[color=orange]<[/color]UNIX_TIMESTAMP(NOW())[color=orange]-[/color]864000 [!--sql2--][/div][!--sql3--]

Share this post


Link to post
Share on other sites
[!--quoteo(post=381993:date=Jun 9 2006, 08:40 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 9 2006, 08:40 PM) [snapback]381993[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Create a field called "date", with a UNIX timestamp containing the date when the booking was made.

Then, to find out which bookings should be expired, query for:

[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] * [color=green]FROM[/color] [color=orange]table[/color] [color=green]WHERE[/color] date[color=orange]<[/color]UNIX_TIMESTAMP(NOW())[color=orange]-[/color]864000 [!--sql2--][/div][!--sql3--]
[/quote]

uhm sorry i don't get it is for what is the 864000???

Share this post


Link to post
Share on other sites
[!--quoteo(post=382174:date=Jun 10 2006, 03:07 AM:name=cabothug)--][div class=\'quotetop\']QUOTE(cabothug @ Jun 10 2006, 03:07 AM) [snapback]382174[/snapback][/div][div class=\'quotemain\'][!--quotec--]
uhm sorry i don't get it is for what is the 864000???
[/quote]

its for refering to the current time

Share this post


Link to post
Share on other sites
Actually NOW() refers to the current time, 864000 just means "minus ten days":

60*60*24*10 = 864000

;)

Share this post


Link to post
Share on other sites
[!--quoteo(post=382237:date=Jun 10 2006, 05:08 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 10 2006, 05:08 PM) [snapback]382237[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Actually NOW() refers to the current time, 864000 just means "minus ten days":

60*60*24*10 = 864000

;)
[/quote]

oh oke thnx
how can i put an automatic date
(when a booking is made that the right date wil be written in the database )

Share this post


Link to post
Share on other sites

×

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.