Jump to content

insert data from mysql database


adi123
 Share

Recommended Posts

I am trying to display data from mysql. Each row from the mysql database shows up under rows.

 

I want the rows of data from mysql  to appear in colums of 4.

 

can some one help please.

 

<?php

$sql = 'SELECT * FROM dbtable ORDER BY id';

$result = $db->query($sql);

$output[] = '<ul>';

while ($row = $result->fetch()) {

$output[] = '<table>';

$output[] = '<tr>';

$output[] = '<td class="style10"><strong>'.$row['item'].'</strong></td>';

$output[] = '</tr>';

$output[] = '<tr>';

$output[] = '<td><img src="images/'.$row['pic'].'" width="100" height="150" /></td>';

$output[] = '</tr>';

$output[] = '<tr>';

$output[] = '<td>'.$row['description'].'</td>';

$output[] = '</tr>';

$output[] = '</table>';

}

echo join('',$output);

?>

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.