• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Mysqli Output to a table

phpmysqlmysqli


PHP Snippet 1:

$requiredRows= 18; 
$rows = $result->num_rows ;
$columns = ceil($rows/$requiredRows);
$i = 0;
while($row = $result->fetch_assoc()) 
    {
    if ($i == 0) {
        echo "<table><tr><td>";
    }
    elseif ($i % $columns) {// <> 0
        echo "</td>\n";
        echo "<td>\n";
    }else{//$i % $columns == 0
        echo "</td>\n";
        echo "</tr>\n";
        echo "<tr>\n";
        echo "<td>\n";
    }
    echo $row['country'];
    $i++;
}

Related Snippets

PHP mail sending empty mails

Manage independently the decimal number of the price of each product [duplicate]

Install mysql client in docker image

PHP: Calling MySQL Stored Procedure with Both INPUT AND OUTPUT Parameters (NOT "INOUT")

Add rows to Single product Additional information table in WooCommerce 3.6

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given [duplicate]

I cannot create a auto generated date time in mysql workbench

WAMP Virtual Host not working

I want a way to give path to my files which are outside of public folder in laravel

How to create a cookie to store the timestamp of when a page is first loaded with php

woocommerce get_order_report_data to show order_item_id

Mysqli multi query error

enable Apache http Authorization header

What will the best solution for this multiple optional filter?

PHP -> Next nearest date defined by array of days in week

About Contact Privacy policy Terms and conditions