Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Webmasters choice

Quote Reply
Webmasters choice
Hi

I have added two fields to Links SQL, one checkbox field, and a comment field. This I use to display the latest webmasters choise link on my frontpage, with its own description in the extra comment field.

I have made a php script that gets the link on the frontpage. The problem is that the frontpage always should show the latest webmasters choice.

How do I get a timestamp in addition in the admin form? So I can do a query like this:
select field1, field2, field3 from database order by webmaster_selected_date desc limit 1.

Since links can already be in the database, I can´t use the original timestamp date made by Links.

Regards,
Are

Quote Reply
Re: Webmasters choice In reply to
I would be thinking of adding an extra checkbox 'isHomepage' and requesting this field too in the query.

Quote Reply
Re: Webmasters choice In reply to
Hi,

The Links table already has a timestamp field, so just do:

SELECT field1, field2, field3 FROM Links
WHERE webmaster_choice = 1
ORDER BY Timestmp DESC
LIMIT 1

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Webmasters choice In reply to
Yes, the Links does put a time stamp when the record is created, but I would like a dedicated timestamp that tells in wich order the links is chosen (so that a timestamp is added when webmaster_choise = 1).

This could also be a autoincreamentnubmer on selected links.

Quote Reply
Re: Webmasters choice In reply to
What about making the isChoice field a DATETIME. You'd have to add code that sets that to the current date/time when the check box is created.

You can only have one timestamp field in a database record (if you think about it, you'll understand why). The timestamp reflects the last time the record was changed. To track other changes, you need to put in "marker" fields. The best way would be to make that field a datetime that if non-null reflects a valid choice, and can be ordered.

PUGDOG®
PUGDOG® Enterprises, Inc.
FAQ: http://pugdog.com/FAQ


Quote Reply
Re: Webmasters choice In reply to
That makes sence. What type of code could it be? Like date('d','m','YY') ?

Quote Reply
Re: Webmasters choice In reply to
You'd need to add code (perl code) to the routine to set the new field to the datetime value of NOW() when/if the right condition is met.

If you define the field as datetime it will store a full datetime value, and only update when you ask it to. I use several of these fields in the postcards database to track when cards are sent, picked up, last picked up, etc., and I set them in the subroutine that assigns them.

I'm not sure where in your set up you'd need to set them.



PUGDOG®
PUGDOG® Enterprises, Inc.
FAQ: http://pugdog.com/FAQ