[EMAIL PROTECTED] wrote:

Hi,

(Please note: NEWBIE WARNING, below questions might sound stupid, but feel
free to flame.) ;-)

I have a table "tbl_users" with a field "dat_an_time" which is a
timestamp(14).
In that I have values such as:
20040222000015
20040227042018
20040223015329
etc

I have searched google/the manual for the answers to the below questions but
I only found answers if
the field is a datetime field and not a timestamp, I cannot change the
format as I am the new
developer of an old (already live) project and lots of scripts are already
accessing this table.

Please tell me how to do this with my current setup.

Two questions:
Question 1.
In my php script I am taking the value of "days_last" which should run a
select query to display all the
records in the last $days_last days (for those of you who dont program in
PHP/Perl $days_last is the
variable that is a number which the user selects. eg: 10 or 5 or 35 etc)

How do I format the query to get the results from my "dat_an_time"
timestamp(14) field?

Somewhat new myself but I believe you can do something like SELECT (whatever you need) FROM tbl_users WHERE (UNIX_TIMESTAMP(now()) - ($days_last*24*60*60)) < UNIX_TIMESTAMP(dat_and_tim).


I will add the the PHP Cookbook and the MySQL Cookbook are godsends and that's where I got the solution. Grab a copy of these to help out - I've got a project due in a week and I'm using these non-stop.


--


Scott Plumlee
PGP Public key: http://plumlee.org/pgp/ D64C 47D9 B855 5829 D22A D390 F8E2 9B58 9CBF 1F8D


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to