PHP mysql query loop to get lowest value -


i need create loop, lowest id value mysql.

so tried script:

<?php include "configuration.php"; // mysql konfiguration $jungiam = mysql_connect("$db_host", "$db_user", "$db_pass"); mysql_select_db($db_name, $jungiam); $darom = mysql_query("select * task id = (         select              min(id)                     task)"); $rez = mysql_num_rows($darom); while ($rez > 1) { $row = mysql_fetch_array($darom);  echo $komanda = $row['komanda']; mysql_query('delete * task komanda = ' .$row['komanda'].''); } return true; ?> 

i need lowest id , print page $row['komanda'], after printing delete table komanda = $row['komanda'] (printed text).

after deleting record, need script start, print text lowest id mysql , after text deleted , proccess start start , repeating until records in table 'task' deleted.

"select * task order id asc limit 1;" 

this return first element lowest id.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -