Php, вложенный цикл while, работает неправильноPhp

Кемеровские программисты php общаются здесь
Ответить
Anonymous
 Php, вложенный цикл while, работает неправильно

Сообщение Anonymous »


I am attempting to get a nested loop to retrieve information from a database and arrange it by type. It retrieves the data but arranges it weird, kinda like this:

Crawler Dozer Excavator |Unit |Type |Year| Make | Model | Engine | --------------------------------------------------------------- |D8-1 |Crawler Dozer|0000| Caterpillar | D8K | D342 | So on and so forth..... It skips the title for the 'Crawler Dozer' and puts it under 'Excavator'. I have reworked the code several different ways, but still get the same result.

This is my code:

if(mysqli_query($conn, "select * from etypes") != null){ $etype_list=mysqli_query($conn, "select * from etypes order by name asc"); while($types_list=mysqli_fetch_array($etype_list)){ $cur_type = $types_list['name']; if(record_exists ("equipment", "type", "{$cur_type}")){ ?> Unit Type Year Make Model Engine Plate

Источник: https://stackoverflow.com/questions/781 ... -correctly
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»