PHP MySQL - For every 6 rows insert a div?

后端 未结 3 977
忘了有多久
忘了有多久 2021-01-29 12:28

PHP:

prepare(\"SELECT * FROM `users`\");
$stmt->execute();
$result = $stmt->get_result();

//
3条回答
  •  甜味超标
    2021-01-29 12:55

    I will reference this question since this is what you need: checking if a number is divisible by 6 PHP

    Your logic you should basically be: If a number is divisible by 6 then do something otherwise do something else.

    if ($row_number % 6 == 0) {
        // Row number is 6, 12, 18 and so on
    } else {
        // Other rows
    }
    

提交回复
热议问题