PHP / HTML / CSS:样式化数据数组 [英] PHP/HTML/CSS: Styling an array of data
本文介绍了PHP / HTML / CSS:样式化数据数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当导入数据数组从数据库(我使用的PHP / MySQL),我怎么去造型用CSS这些信息?我假设我html标签添加到从阵列中的每个单独的一块数据?但如果因此在该阶段将我分配这些标签?
When importing an array of data from a database (i'm using php/mysql), how do I go about styling this information with css? I'm assuming I add html tags to each separate piece of data from the array? but if so at which stage would I assign these tags?
我有点新的PHP,但我确定CSS和XHTML。
I'm a bit new to php but am ok with css and xhtml.
目前我的数组包含:
Business_Name | Address | Tel | Service | Url | Email | Recommendations | Image_Url
任何帮助将是非常美联社preciated。
Any help would be much appreciated.
编辑:一图胜千言:0)
A picture paints a thousand words :0)
推荐答案
尝试做一个for循环宽度您阵列
try doing a for loop width you array
像
<?php
echo "<ul>";
foreach($array as $arrkey){
echo "<li>".$arrkey."</li>";
}
echo "</ul>";
?>
和做一些CSS的&LT;李方式&gt;
编辑:
<?php
$cont=0;
echo '<ul>';
foreach($array as $arrkey){
echo '<li class="yourclass-.$cont.'">'.$arrkey.'</li>';
$cont++;
}
echo "</ul>";
?>
然后每个样式&LT;立GT;
像
li.yourclass-0{
}
这篇关于PHP / HTML / CSS:样式化数据数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文