$select_works=mysqli_query($connection,"SELECT *, habitaciones.id id_habitacion, (select `nombre_archivo` from imagenes where id_content=id_habitacion and categoria='habitaciones' order by listorder limit 1) imagen from habitaciones order by habitaciones.orden"); ?>
while ($row_work = mysqli_fetch_object($select_works)) { $i++; ?>