Solved

Mysql Problem selecting timestamp modification in last 24 hours

Posted on 2009-04-05
1
303 Views
Last Modified: 2013-12-12
Hi Folks,
I have a problem with this query - all I want to do is to get the rows from a table - in this case property - that have been modified in the last 24 hours.
The query runs and looks at the prop_timestamp field, which is an auto updating timestamp field whic updated every time a record is edited BUT it just seems to ignore the timestamp comparison and just returns all rows with a status of 1 ???
I look at it an I reckon it should work but I am going round in circles
SELECT * FROM property p
LEFT JOIN property_branches pb ON pb.branch_id = p.branch_id
LEFT JOIN property_price_prefix ppp ON ppp.prefix_id = p.prefix_id
WHERE p.prop_timestamp > UNIX_TIMESTAMP(NOW()) - 86400 
AND prop_status = '1'

Open in new window

0
Comment
Question by:AlltekTF
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
AlltekTF earned 0 total points
ID: 24075103
Ahh - solved it:

Just changed the sql to:

WHERE UNIX_TIMESTAMP(p.prop_timestamp) > UNIX_TIMESTAMP(NOW()) - 86400

sit compared unix timestamps as similar data types - totally missed it before
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
splitting a sting into elements 6 75
Form submit takes only for one form 23 54
Php variable to be sent back 3 35
Sending JSON Via POST In PHP 7 28
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question