Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何显示新更新的四幅图像?_Php_Fetch - Fatal编程技术网

Php 如何显示新更新的四幅图像?

Php 如何显示新更新的四幅图像?,php,fetch,Php,Fetch,我的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

我的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-->


只有一个新更新的图像正在获取。但我希望获取四个新更新的图像并显示在页面上。我无法实现这一点。每行都获取相同的图像。如何循环数据库的最新条目?

您应该进一步解释您的问题。什么是“最新更新图像”?你想实现什么?实际上我想显示四个最新更新的条目。但问题是它只显示一个最新条目。我的问题是如何显示四个最新条目?例如:我插入了img1.jpg、img2.jpg、img3.jpg,但是它只显示img4.jpg。我想要实现的是显示所有四个图像。你只是重复了你自己。这已经在你的问题文本中了。请编辑您的问题,以便更好地描述您的目标和问题。和更少的代码请,只有相关的部分!(我从没想过我会这么说…)你能告诉我问题的哪一部分让人困惑吗?这可能有助于我更好地描述我的问题。