我有以下的HTML代碼前4行:PHP顯示了在不同的地方
<div class="content-block1">
<div class="image-block1"></div>
<div class="bear1"></div>
<div class="where-block1"></div>
<div class="intro-block1"></div>
<div class="map-block1"></div>
<div class="extra-block1"></div>
<div class="coordinates-block1"></div>
<a href=""><div class="button-block1">More...</div></a>
</div>
<div class="content-block2">
<div class="image-block2"></div>
<div class="bear2">/div>
<div class="where-block2"></div>
<div class="intro-block2"></div>
<div class="map-block2"></div>
<div class="extra-block2"></div>
<div class="coordinates-block2"></div>
<a href=""><div class="button-block2">More...</div></a>
</div>
..和下面的PHP代碼:
$host = "localhost";
$user = "username";
$pass = "password";
$database = "db";
mysql_connect($host,$user,$pass,$database) or die(mysql_error());
mysql_query("SET NAMES 'utf8'");
$query = mysql_query("select image,where,intro,map,extra,coordinates from content limit 2");
mysql_close();
現在,我已經試過很難做到以下幾點:我需要在表格內容中選擇前兩行,其中包括列圖像,其中包括介紹,地圖,附加和座標(不包括)。好的,我選擇了查詢,但我有下一個問題 - >我需要將第一行的內容放在名爲content-block1的第一個DIV元素中,因此,列圖像,位置,介紹,地圖,額外和座標需要在內容塊1中適合他們的div。另外,我需要將第二行(圖像,where,intro,map,extra和coordinate)的數據放入名爲content-block2的DIV元素中並放入它們所屬的DIV中。你能幫我嗎?
閱讀,標記,學習和消化內側附https://dev.mysql.com/doc/refman/5.5/en /reserved-words.html – Strawberry