Question: my MYSQL table is as below:

```
id   record_nr    timestamp
1    931          2014-02-15 6:21:00
2    577          2013-05-03 0:19:00
3    323          2012-08-07 11:26:00

```

in PHP I tried to retrieve a record by comparing time as below:

```
$dateTimeString = "2013-07-28 7:23:34";

$query = "SELECT * FROM mytable ";
$query .= "WHERE timestamp <= STR_TO_DATE('".$dateTimeString."', '%H:%i:%s')";
$query .= " ORDER BY timestamp DESC LIMIT 1";

```

This didn't work. How to retrieve the record #577? Timestamp is not the time the record was created. Rather, it is a date and time associated with that record.

Answer: 
You are sending an ajax request to update the record. So, you should not try to `render` a view or `redirect` user as the response of this request. Instead, you can send back a JSON object with some properties e.g. "status".

Then on client side, you check the returned JSON response and based on "status" parameter ( or any other you chose ), you can either update your data or reload the page using `window.reload` on client side.
Your db query says

```
db.none('update cands set name=$1, email=$2 where id=$8', [req.body.name, req.body.email]) ...

```

Shouldn't it be

```
db.none('update cands set name=$1, email=$2 where id=$8', [req.body.name, req.body.email, candID])

```