Closed Thread Icon

Topic awaiting preservation: display date of last mysql table addition Pages that link to <a href="https://ozoneasylum.com/backlink?for=12496" title="Pages that link to Topic awaiting preservation: display date of last mysql table addition" rel="nofollow" >Topic awaiting preservation: display date of last mysql table addition\

 
Author Thread
patric design
Bipolar (III) Inmate

From: 290 km/h, fast lane, Autobahn, Germany
Insane since: Feb 2001

posted posted 10-28-2002 22:11

i have a website based backed by an mysql database and I'd like it to display the "last updated" date on the main page. since the database is merely used for generating a list table it probably shouldn't be too hard. the database entries don't have dates.

how can i do this? (in php preferably)

Cheers

<´¯`·.¸ Patric ¸.·´¯`>

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 10-28-2002 22:54

I'm not aware of the date being stored, so I don't think it's possible. You'd need to modify the table to include a date field, and handle appropriately.

Perfect Thunder
Paranoid (IV) Inmate

From: Milwaukee
Insane since: Oct 2001

posted posted 10-29-2002 00:58

Yep, just add a "datetime" field to the table, and whenever you do an INSERT or UPDATE query, use the SQL function NOW() to generate the date. Like, "INSERT INTO table (id, content, datetime) VALUES ($variable1, $variable2, NOW())" Edit: fixed syntax

Then, to get a "last updated," "SELECT MAX(datetime) as datetime FROM table". The SQL result column "datetime" will contain the table's highest (most recent) value of that field.

[This message has been edited by Perfect Thunder (edited 10-29-2002).]

patric design
Bipolar (III) Inmate

From: 290 km/h, fast lane, Autobahn, Germany
Insane since: Feb 2001

posted posted 10-29-2002 15:33

thanx guys,

I'll add a date field and see how that goes...

<´¯`·.¸ Patric ¸.·´¯`>

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 10-29-2002 19:48

Moving this to the server-side forum............

___________________
Emps

FAQs: Emperor

« BackwardsOnwards »

Show Forum Drop Down Menu