0
Below is the script closer than I need to generate Mysql results in 3 columns. Even so it didn’t work for me to do the test.
Generating the error: Fatal error: Uncaught Error: Call to undefined function mysql_num_rows()
Error refers to this line: $num = ceil( mysql_num_rows( $query ) / $colunas );
Complete code:
<?php
$query=mysqli_query($con,"select categoria, link from categorias ORDER BY categoria ASC");
$colunas = 3;
$num = ceil( mysql_num_rows( $query ) / $colunas );//quantidade de registros por coluna
$li = '<ul class="coluna">';
$i = 0;
while( $dados = mysql_fetch_object( $query ) )
{
if( $i==$num )
{
$li .= '</ul><ul class="coluna">';
$i=0;
}
$li .= '<li>'.$dados->bairro.'</li>';
$i++;
}
$li .= '</ul>';
echo $li;
?>
Puts i in mysql_num_rows, and mysql_fetch as well
– David Santos