i have a select query on may database
while($row=mysql_fetch_assoc(mysql_query("select * from items"))){
//here
}
i want it to display a grid style, and im using the
while($row=mysql_fetch_assoc(mysql_query("select * from "))){
?>
<tr>
<td><img src="<?php echo $row['path']?>"></td>
</tr>
<tr>
<td><?php echo $row['name'] ?></td>
</tr>
<?php
}
but it will display a vertical style, what html tag will i use, i also use the <span>
but i cant display it correctly
In that case much better to wrap output of row in a function. Smth like the following:
function showRow($row) {
?>
<tr>
<td><img src="<?php echo $row['path']?>"></td>
<td><?php echo $row['name'] ?></td>
</tr>
<?
}
And then:
<table>
<?
while($row=mysql_fetch_assoc(mysql_query("select * from "))){
showRow($row);
}
?>
</table>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.