Note that there are some explanatory texts on larger screens.

plurals
  1. POSort MySQL table by timestamp
    primarykey
    data
    text
    <p>I got a data acquisition board running, and I generate a php code to extract the data every 15 min and then insert it in a table.</p> <p>This works fine. However, if for some reason the connection is lost or some value is missing, I want to generate a recover function, so I figure out how to ask the board for some values, but I need to figure out how to post the recovered data and then sort the whole table order by timestamp.</p> <p>For that I want to use php, and I place this code </p> <pre><code>$result = mysql_query("SELECT * FROM `table` ORDER BY `date` DESC;" ); </code></pre> <p>But this doesn't cause any effect. I need to sort the table not the result.</p> <p>Is there any easy way to do that?</p> <p><strong>EDIT</strong>:</p> <p>The data is extracted with a timestamp, now my table has the following structure:</p> <pre><code>id | TimeStamp | Temperature </code></pre> <ul> <li>my <code>id</code> is <code>INT NOT NULL AUTO_INCREMENT PRIMARY KEY</code></li> <li><code>timestamp</code></li> <li><code>temperature</code> is <code>varchar(15)</code></li> </ul> <p>The php function gets the last value of the adquicition board and insert it on the last id. I just place the time stamp to make a historial of the data. But I want the table to be sort by this field, in case of a recovery. To make a recovery the call function to the board is way different to the continuous mode.That's why I use sequencial insert and I was wandering if after the lost data recover is done I could sort the whole table using the timestamp.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload