[英]PHP - Get mysqli data to display side by side with css
I want this table of data to be displayed in 3 columns instead of 1 column as it's doing now; 我希望此数据表显示为3列而不是现在的1列; how would I do this with CSS ? 我将如何使用CSS做到这一点?
<?php echo "<table><tr><th>Tours</th></tr>"; while($rowTours = $resultTours->fetch_assoc()){ echo "<tr><td><h4>{$rowTours['Destination']}</h4>"; echo "\\r\\n £ {$rowTours['Price']}\\r\\n"; echo "\\r\\n{$rowTours['Description']}"; echo "<img src=\\"img/{$rowTours['destimg']}\\" class =\\" img-circle img-thumbnail\\"> </td></tr>"; } echo "</table>"; ?>
Maybe to move tr tags outside the loop, where is table tag, like this? 也许将tr标签移动到循环之外,表标签在哪里,像这样? tr is row, td is cell in row, and i guess that you have 3 results in loop, and you wanna each in one cell (column)? tr是行,td是行中的单元格,我想您在循环中有3个结果,而您想在一个单元格(列)中分别显示?
<?php
echo "<table><tr><th>Tours</th></tr><tr>";
while($rowTours = $resultTours->fetch_assoc()){
echo "<td><h4>{$rowTours['Destination']}</h4>";
echo "\r\n £ {$rowTours['Price']}\r\n";
echo "\r\n{$rowTours['Description']}";
echo "<img src=\"img/{$rowTours['destimg']}\" class =\" img-circle img-thumbnail\"> </td>";
}
echo "</tr></table>";
?>
<?php
echo "<table>
<TR>
<TH>Destination</TH> <TH>Price</TH> <TH>Description</TH>
</TR>";
while($rowTours = $resultTours->fetch_assoc()){
echo "<TR>
<TD><h4>{$rowTours['Destination']}</h4>
<img src=\"img/{$rowTours['destimg']}\"
class =\" img-circle img-thumbnail\">
</TD>
<TD>£ {$rowTours['Price']}</TD>
<TD>{$rowTours['Description']}</TD>
</TR>";
}
echo "</table>";
?>
<?php
echo "<table><tr><th>Tours</th></tr><tr>";
while($rowTours = $resultTours->fetch_assoc()){
echo "<td><h4>{$rowTours['Destination']}</h4></td>";
echo "<td>£ {$rowTours['Price']}</td>";
echo "<td><img src=\"img/{$rowTours['destimg']}\" class =\" img-circle img-thumbnail\"> </td>";
}
echo "</tr></table>";
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.