Hi Rolf
Thanks for your response. I discovered the problem was with the semi colon after
price. Here is the query that I used...
SELECT * FROM kawarthas, Customer WHERE (DATE_SUB(CURRENT_TIMESTAMP, interval 36
HOUR)) < kawarthas.timestamp AND (kawarthas.agent1aid=Customer.MemberID) ORDER BY
price
and it appears to be working fine.
I will rename the timestamp column to something more appropriate and try to avoid the
"C" like boolean expressions. I am developing in PHP. I bought the SAMS Teach Yourself
MySQL in 21 Days book but I guess I should take it for what it is, "A small book on a
big subject".
What I was attempting to do was display the information on a "What's New" webpage for
up to 36 hours and 168 hours. I fiddled with the timestamp values and it appears to be
working fine.
Cheers
Ken Tuck
Rolf Hopkins wrote:
> Hi Ken,
>
> Welcome to the list. You'll get great help here, best support I've ever
> come across but you do need to do your own research first. Try reading the
> relevant sections of the manual again but a little more thoroughly this
> time.
>
> To get you started, you're mixing C code with SQL code. You use "AND" in
> sql, not "&&". Another is the semi-colon in "price;". The only time you
> use ";" is at an SQL prompt to tell the database you have come to the end of
> your SQL statement and the DB can now execute it and return the results.
>
> timestamp is not a good name to name your columns. It is a good idea that
> you don't use reserved words for your column names.
>
> I'm not sure what you are trying to do with your second "if"? If I'm right,
> you need a trickier piece of code to get the correct results. Are you
> trying to get the first day of the week? Haven't tested yours but if Monday
> was the first day of the week and today is Tuesday then you would get
> Tuesday last week, not Monday this week.
>
> ----- Original Message -----
> From: "Ken Tuck" <[EMAIL PROTECTED]>
> To: "MySQL" <[EMAIL PROTECTED]>
> Sent: Tuesday, February 27, 2001 1:47
> Subject: Newbie DATESTAMP problem
>
> > Hi All
> >
> > This is my first post of possibly many to this list. I am having a
> > problem with trying to display time related content to a page. I
> > initially setup the column with a 10 digit timestamp but found out that
> > the date_sub function works with DATESTAMP data type. I only have 8 rows
> > of test data in the table so I didn't loose anything valuable but now
> > the column isn't automatically putting in the date in the format that I
> > need.
> >
> > I suppose the question is where do I go now and is the following query
> > using the correct syntax?
> >
> > if ($type == "newtoday"){
> > $sql_text = ("SELECT * FROM kawarthas, Customer WHERE
> > kawarthas.timestamp< (date_sub(now()+0, interval 2 DAY)) &&
> > (kawarthas.agent1aid=Customer.MemberID) ORDER BY price;");
> > }
> > if ($type == "newthisweek"){
> > $sql_text = ("SELECT * FROM kawarthas, Customer WHERE
> > kawarthas.timestamp<= (date_sub(now()+0, interval 7 DAY)) &&
> > (kawarthas.agent1aid=Customer.MemberID) ORDER BY price;");
> > }
> >
> >
> > --
> > Cheers!
> > Ken Tuck
> > EyeCreate Inc.
> > Net~Solutions
> > Design - Hosting - E-Commerce
> > [EMAIL PROTECTED]
> > http://www.eyecreate.net/
> > ph: 705 755-1120
> > fx: 705 743-9259
> >
> >
> >
> > ---------------------------------------------------------------------
> > Before posting, please check:
> > http://www.mysql.com/manual.php (the manual)
> > http://lists.mysql.com/ (the list archive)
> >
> > To request this thread, e-mail <[EMAIL PROTECTED]>
> > To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
--
Cheers!
Ken Tuck
EyeCreate Inc.
Net~Solutions
Design - Hosting - E-Commerce
[EMAIL PROTECTED]
http://www.eyecreate.net/
ph: 705.755.1120
fx: 705.743.9259
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php