Urgent !! High score for advice !! How can I achieve a list of multiple images in one row by traversing the database and the paging function is urgent !! You can traverse the database to implement a list of multiple images in one row and the paging function. it is best to share the instance code to: Urgent !! High score for advice !! How can I traverse the database to implement a list of multiple images in one row and the paging function?
Urgent !! You can traverse the database to implement a list of multiple images in one row and the paging function. it is best to have the instance code.
Share:
------ Solution --------------------
Isn't it paging ??
As for the arrangement of your images, that is your layout problem.
Unlike normal paging
------ Solution --------------------
Reference:
Reference:
Urgent !! You can traverse the database to implement a list of multiple images in one row and the paging function. it is best to have the instance code.
Ask !! How to layout,
Isn't layout a problem with CSS?
So far!
------ Solution --------------------
$ Num = 4; // number of sheets per line
$ I = 0; // counter
While ($ row = mysql_fetch_assoc ($ rs )){
If ($ I = 0) echo'';
Echo''. $ Row ['image field name'].'';
$ I = ($ I + 1) % $ num;
If ($ I = 0) echo'';
}
If ($ I! = 0) echo'';
------ Solution --------------------
Reference:
I use php to traverse the database to get the data output in the image table, but I do the traversal, only need to make an image box, and then output all the images through the loop (I have done it before, however, the output is a row of images. I am wondering how to arrange the output Images From left to right (for example, to put four images in one row )?
Your question falls into the category of the front-end artist. since you asked, I will talk to you briefly. it is actually very simple, but it is just a matter of control during the cycle.
I will give two examples. The first is table, and the second is p layout.
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 method requires css control.
# Box p {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 can be changed to the image address by yourself.