我的php代码是-
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$dbname = 'moviefone';
$con = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname, $con); // Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$data = mysql_query("SELECT * FROM new_hindi") or die(mysql_error());
$info=NULL;
while ($row = mysql_fetch_array($data))
{
$info=$row;
}
?>
和 html 是
<div id="main_column"> <div class="column-1">
<div class="sub-column1">
<a href="#" class="new_movies"><span>New</span></a>
<a href="#"><img src="<?php echo $info["images"];?>" width="140" height="200" class="new-img" /></a>
<a href="#" class="img_titles"><?php echo $info["title"];?></a>
<a href="#" class="new_english"><span>New</span></a>
</div>
<div class="sub-column1">
<a href="#"> <img src="#" width="140" height="200" class="new-img" /></a>
<a href="#" class="img_titles">nothing</a>
<a href="#" class="theater"><span>In THEATERS</span></a>
</div>
<div class="sub-column1">
<a href="#"><img src="images/packshot._UX140_CR0,0,140,200_V1349717863_Lovefilmgb169343_.jpg" width="140" height="200" class="new-img" /></a>
<a href="#" class="img_titles">Example8</a>
<a href="#" class="upcoming"><span>Upcoming</span></a>
</div>
<div class="sub-column1">
<a href="#"> <img src="images/packshot._UX140_CR0,0,140,200_V1349717863_Lovefilmgb169343_.jpg" width="140" height="200" class="new-img"/></a>
<a href="#" class="img_titles">Example12</a>
</div>
</div>
<div class="column-2">
<div class="sub-column1">
<a href="#"><img src="<?php echo $info["images"];?>" width="140" height="200" class="new-img" /></a>
<a href="#" class="img_titles"><?php echo $info["title"];?></a>
</div>
<div class="sub-column1">
<a href="#"> <img src="images/packshot._UX140_CR0,0,140,200_V1349717863_Lovefilmgb169343_.jpg" width="140" height="200" class="new-img" /></a>
<a href="#" class="img_titles">Example5</a>
</div>
<div class="sub-column1">
<a href="#"><img src="images/packshot._UX140_CR0,0,140,200_V1349717863_Lovefilmgb169343_.jpg" width="140" height="200" class="new-img" /></a>
<a href="#" class="img_titles">Example9</a>
</div>
<div class="sub-column1">
<a href="#"> <img src="images/packshot._UX140_CR0,0,140,200_V1349717863_Lovefilmgb169343_.jpg" width="140" height="200" class="new-img"/></a>
<a href="#" class="img_titles">Example13</a>
</div>
</div>
<div class="column-3">
<div class="sub-column1">
<a href="#"><img src="<?php echo $info["images"];?>" width="140" height="200" class="new-img" /></a>
<a href="#" class="img_titles"><?php echo $info["title"];?></a>
</div>
<div class="sub-column1">
<a href="#"> <img src="images/packshot._UX140_CR0,0,140,200_V1349717863_Lovefilmgb169343_.jpg" width="140" height="200" class="new-img" /></a>
<a href="#" class="img_titles">Example6</a>
</div>
<div class="sub-column1">
<a href="#"><img src="images/packshot._UX140_CR0,0,140,200_V1349717863_Lovefilmgb169343_.jpg" width="140" height="200" class="new-img" /></a>
<a href="#" class="img_titles">Example10</a>
</div>
<div class="sub-column1">
<a href="#"> <img src="images/packshot._UX140_CR0,0,140,200_V1349717863_Lovefilmgb169343_.jpg" width="140" height="200" class="new-img"/></a>
<a href="#" class="img_titles">Example14</a>
</div>
</div>
<div class="column-4">
<div class="sub-column1">
<a href="#"><img src="<?php echo $info["images"];?>" width="140" height="200" class="new-img" /></a>
<a href="#" class="img_titles"><?php echo $info["title"];?></a>
</div>
<div class="sub-column1">
<a href="#"> <img src="images/packshot._UX140_CR0,0,140,200_V1349717863_Lovefilmgb169343_.jpg" width="140" height="200" class="new-img" /></a>
<a href="#" class="img_titles">Example7</a>
</div>
<div class="sub-column1">
<a href="#"><img src="images/packshot._UX140_CR0,0,140,200_V1349717863_Lovefilmgb169343_.jpg" width="140" height="200" class="new-img" /></a>
<a href="#" class="img_titles">Example11</a>
</div>
<div class="sub-column1">
<a href="#"> <img src="images/packshot._UX140_CR0,0,140,200_V1349717863_Lovefilmgb169343_.jpg" width="140" height="200" class="new-img"/></a>
<a href="#" class="img_titles">Example15</a>
</div>
</div>
</div><!--main cloumn-->
只有一个新更新的图像正在获取。但我想要四个新更新的更新图像被获取并显示在页面上。我无法实现这一点。每一行都在获取相同的图像。如何循环数据库的最新条目?