Select database where datetime>now()?

I have 2 questions:

  1. How can i select the data from the database where datetime>now() by writing php code?

  2. if there is the data from the database where datetime>now() , i want select the last two value from the database. what should i do?

I'm doing my gps tracking website. At the moment,my page is just select the last data to show the last position on the map. What i want is ,when i login my page, i will see the final position of the vehicle, and if the vehicles moves(mean the datetime of the data in database>now(), i want to select the 2 last updated data frequently to caculate the distance

Answers


  1. Store now() in a variable and then compare using where clause.

Also see this and this

Update :<?php $timeZone = 'Asia/Kolkata'; //variable for indian timezone date_default_timezone_set( $timeZone); //default timezone set to indian time $now = date("m/d/y G.i:s"); echo $now; ?>

Check for date functions in PHP


Need Your Help

Case expression in where clause PL/SQL

oracle plsql case where

How could I query something like this in PL/SQL?

Getting Data from Notification

android notifications statusbar

I am wiriting application and I don't know how to get data from Notification. I have NotificationListenerService (like this) and when new Notification occurs I recieve StatusBarNotification object.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.