How to implement the paging function by traversing the database and implementing a single line of multiple picture lists

Source: Internet
Author: User
Hurry!! High score to ask!! How can I traverse the database to implement a single line of multiple picture lists and achieve paging function
Hurry!! How can you walk through the database to implement a single line of multiple picture list and achieve paging function, preferably Instance Code

Share to:


------Solution--------------------
Is it just paging??

As for the arrangement of your pictures, that is your layout problem.

No different from ordinary pagination
------Solution--------------------
References:
references:
Hurry!! How can you walk through the database to implement a single line of multiple picture list and achieve paging function, preferably with instance code

Ask!! How to Layout,

Is the layout not a CSS thing?










It's almost like this!

------Solution--------------------
$num = 4; Number of sheets per line
$i = 0; Counter
while ($row = Mysql_fetch_assoc ($rs)) {
if ($i = = 0) echo '';
Echo '' . $row [' Picture field name ']. '';
$i = ($i + 1)% $num;
if ($i = = 0) echo '';
}
if ($i! = 0) echo '';

------Solution--------------------
Reference:
I am using PHP to traverse the database to get the data output in the image of the table, but I do the traversal, only need to make a picture box, and then through the loop, output all the pictures (I have done before, but the output is a single picture), What I'm wondering now is how to make the output picture go from left to right (like 4 pictures on one line)?

Your problem belongs to the front-desk art category, since you asked, then I will simply talk to you, actually very simple, but is the cycle of time to control it
I say two examples, the first one is the table and the second one is Div typesetting

Echo "











"; for ($i =0; $i <10; $i + +) {if ($i% 3==0) {if ($i >0) {Echo] ";} Else{echo " ";}} Else{echo " ";}} Echo "
1
";


Below is the second method
This approach requires CSS to be controlled
#box div{float:left;width:33%;}

Echo "";
for ($i =0; $i <10; $i + +) {
Echo "1";
}
Echo "";


------Solution--------------------

echo "















"; $i = 1;foreach ($arr as $value) {$str =" if ($i%3==0------Solution--------------------$i ==1) echo $i = = 1? " ". $str: $str." "; Elseecho $str; $i + +;} echo "
$value
";

$value yourself into a picture address.
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.