我正在 phpmyadmin 中從我的表中呼叫一些資料,它復制了 phpmyadmin 中的資料量的表,我只想要我資料庫中的最后一個資料
</div>
<?php
$sql="SELECT * from roberto";
$result=mysqli_query($conexion,$sql);
while($mostrar=mysqli_fetch_array($result)){
?>
<table class="table is-striped is-narrow is-hoverable is-fullwidth">
<thead>
<tr>
<th>Tipo</th>
<th>Niveles</th>
<th>Estado</th>
</tr>
</thead>
<tbody>
<tr>
<th>pH Sensor <spab></th>
<td><p>Nivel de pH: <strong><span id="PHvalue"></span><?php echo $mostrar['nivelph']; ?></strong></p>
</td>
<td>Funcionando</td>
</tbody>
<tbody>
<tr>
<th>Caudalímetro</th>
<td><p><strong><?php echo $mostrar['caudal']; ?>10L/min</strong></p>
</td>
<td>Funcionando</td>
</tbody>
<tbody>
<tr>
<th>Bomba subir pH ↑</th>
<td><span>""" str(ph) """pH</span>
</td>
<td>Subiendo el pH↑</td>
</tbody>
<tbody>
<tr>
<th>Bomba bajar pH ↓</th>
<td><span>""" str(ph) """pH</span>
</td>
<td>Bajando el pH↓</td>
</tbody>
<tr>
<th>Nutrientes</th>
<td><span>1mL/24horas</span>
</td>
<td>Activando bomba</td>
</tbody>
</table>
</section>
<?php
}
?>
?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ??????????????
uj5u.com熱心網友回復:
如果你想要表中所有行的最后一個,那么這是答案:
SELECT * FROM roberto ORDER BY id DESC LIMIT 1;
uj5u.com熱心網友回復:
此代碼帶來了插入資料庫連接的最后一個 id
printf("Last inserted record has id %d\n", mysql_insert_id($conn));
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/318715.html
標籤:php mysql 数据库 phpmyadmin
