Deleting rows from mysql that older than 1 minute : <p>I have MySQL database in LAMP server, Database is called coe and table is called pulses. the columns are:</p>

<p>Pulse |    int  </p>

<p>id    |    int</p>

<p>time  |    timestamp - current timestamp</p>

<p>I want select all values in pulse and then choose the max value with last 1 minute from current time. After that, I want to delete all rows in table with also last 1 minute.</p>

<p>I tried this code:</p>

<pre><code>&lt;?php 

$servername = "localhost"; 
$username = "root";  
$password = "";
$dbname = "testdb";

$mysqli = mysqli_connect ($servername, $username, $password, $dbname);
$res = mysqli_query($mysqli, "SELECT MAX(pulse) as pulse FROM pulses where pulse BETWEEN 400 and 500 AND time &gt; UNIX_TIMESTAMP() - 60");
$row = mysqli_fetch_assoc($res);
echo $row['pulse'];
$DeleteQuery = mysql_query('DELETE FROM pulses WHERE time &gt; (UNIX_TIMESTAMP() - 60)');
?&gt;
</code></pre>

<p>The code section of connection with database and select data with max value that work and it is not deleting the rows. i tried a lot but without success. please help</p>
