Jump to content

insert data from mysql database


adi123

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
https://forums.phpfreaks.com/topic/211885-insert-data-from-mysql-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.