Jump to content
Fórum Script Brasil
  • 0

Dividir consulta em 3 colunas


anjomd
 Share

Question

Boa noite pessoal, preciso dividir uma consulta em 3 colunas, segue o que eu tentei fazer. Obrigado a todos.

function selectavatar(){
$database = new Database();
$database->SelectWebsite();
$i=1;

$sqlsavatar = mysql_query("SELECT * FROM avatars");

$rowavatar = @mysql_num_rows($sqlsavatar);

if (!$rowavatar) {
echo "Avatar não encontrado";
}
else
{
if ($rowavatar > 0) {
while ([email protected]_fetch_array($sqlsavatar)){
$id = $txtavatar['id'];
$avatar = $txtavatar['av'];
$sexo = $txtavatar['sexo'];
$html = "
<div style='margin:auto;'>
<div>{$id}</div>
<div><img src='{$avatar}' width='180' height='178'></div>
<div></div>
</div>
";


if( $i%3 == 0 ) {
echo $html;
}
$i++;
}
}
}

}

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      150.1k
    • Total Posts
      647.1k
×
×
  • Create New...