Jump to content


Photo

help with a school project


  • Please log in to reply
5 replies to this topic

#1 cabothug

cabothug
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 09 June 2006 - 06:21 PM

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


#2 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 09 June 2006 - 06:40 PM

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] * FROM table WHERE date<UNIX_TIMESTAMP(NOW())-864000 [!--sql2--][/div][!--sql3--]
~ D Kuang

#3 cabothug

cabothug
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 10 June 2006 - 08:07 AM

[!--quoteo(post=381993:date=Jun 9 2006, 08:40 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 9 2006, 08:40 PM) View Post[/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] * FROM table WHERE date<UNIX_TIMESTAMP(NOW())-864000 [!--sql2--][/div][!--sql3--]
[/quote]

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

#4 legohead6

legohead6
  • Members
  • PipPipPip
  • Advanced Member
  • 434 posts

Posted 10 June 2006 - 02:47 PM

[!--quoteo(post=382174:date=Jun 10 2006, 03:07 AM:name=cabothug)--][div class=\'quotetop\']QUOTE(cabothug @ Jun 10 2006, 03:07 AM) View Post[/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
"Syntax error" .. WHERE THE **** IS IT?!

#5 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 10 June 2006 - 03:08 PM

Actually NOW() refers to the current time, 864000 just means "minus ten days":

60*60*24*10 = 864000

;)
~ D Kuang

#6 cabothug

cabothug
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 11 June 2006 - 08:35 AM

[!--quoteo(post=382237:date=Jun 10 2006, 05:08 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 10 2006, 05:08 PM) View Post[/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 )




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users