Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/254.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 - Fatal编程技术网

Php 从数组分页

Php 从数组分页,php,Php,我一直在尝试把我的照片分页,但是非常非常不成功。我希望我能得到一些关于如何做的提示。这是我的密码 <?php $result = mysql_query("SELECT * FROM images ORDER BY position"); while ($image = mysql_fetch_array($result)){ ?> <img src="images/uploads

我一直在尝试把我的照片分页,但是非常非常不成功。我希望我能得到一些关于如何做的提示。这是我的密码

<?php                                           
   $result = mysql_query("SELECT * FROM images ORDER BY position");
   while ($image = mysql_fetch_array($result)){
?>
<img src="images/uploads/thumbs/<?php echo $image['thumb'];?>" width="100%" height="100%" alt="" class="thumbnail" />
<input type='button' value='Preview' onclick="changedesc(<?php echo $image['image_id']; ?>); return false;" />
<?php }?>

“width=“100%”height=“100%”alt=“class=”缩略图”/>
这个应该可以

  <?php
    $query = "SELECT * FROM images ORDER BY date";
    $result = mysql_query($query);

    while ($image = mysql_fetch_assoc($result)){
        echo '
    <img src="images/uploads/thumbs/'.$image['thumb'].'" width="100%" height="100%" alt="" class="thumbnail" />
    ';
    }
    ?>