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 "
1 | ";}} Echo "
";
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 ="
$value | if ($i%3==0------Solution--------------------$i ==1) echo $i = = 1? "
". $str: $str."
"; Elseecho $str; $i + +;} echo "
";
$value yourself into a picture address.