Web Design Forum: Showing dates from a database... - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Showing dates from a database... Rate Topic: -----

#1 User is offline   ITlocal 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 186
  • Joined: 12-August 08
  • Reputation: 0
  • Location:Norwich, UK
  • Experience:Intermediate
  • Area of Expertise:Entrepreneur

Posted 16 December 2008 - 09:06 AM

Hi,
I have a website which I need to add a list of dates and training locations too. My plan is to enter these all into a database and bring in the lastest 4 (or more, but excluding past events) dynamically at anyone time.

Does anyone know the easiest way to do this? my site is in PHP...


Thanks
0

#2 User is offline   ChristopherDarling 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 343
  • Joined: 27-November 08
  • Reputation: 7
  • Gender:Male
  • Location:Bristol - UK
  • Experience:Advanced
  • Area of Expertise:Designer/Coder

Posted 16 December 2008 - 11:12 AM

Use the PHP Date() Function to format the Date to be inserted into your Database :] (take a look on php.net manuals)


Hope this helps
0

#3 User is offline   ITlocal 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 186
  • Joined: 12-August 08
  • Reputation: 0
  • Location:Norwich, UK
  • Experience:Intermediate
  • Area of Expertise:Entrepreneur

Posted 16 December 2008 - 01:27 PM

I don't want to insert to a database though, I want to retrieve information from it to display in a div...

I am new to PHP so I have no idea really...

I guess this should also be moved to the PHP section? Sorry!
0

#4 User is offline   Connetu_C 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 425
  • Joined: 12-December 08
  • Reputation: 25
  • Gender:Male
  • Location:London, UK
  • Experience:Advanced
  • Area of Expertise:Web Developer

Posted 16 December 2008 - 02:53 PM

There are a couple of ways. Either do the formatting you want in SQL inside the database query using MYSQL DATE_FORMAT function, or extract the timestamp from MySQL and do the formatting in PHP using PHP's date function. There are examples on both of those pages. It really doesn't matter which you choose, though the latter might make it easier to "internationalise" the format of your dates for different locales.
0

#5 User is offline   ITlocal 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 186
  • Joined: 12-August 08
  • Reputation: 0
  • Location:Norwich, UK
  • Experience:Intermediate
  • Area of Expertise:Entrepreneur

Posted 16 December 2008 - 04:15 PM

Ok, thanks, but back about 20 steps...

Are there any tutorials for creating simple databases and linking them so they populate a webpage...
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users