Php loop error
Include_once 'MySQL. php ';
$ C = "";
$ Rownum = 5; // number of vehicles to be displayed in each row
$ Picindex = 1; // $ picindex serial number
$ Newrow = 0; // whether to wrap the line. if the value is 1, it will wrap the line.. If the value is 0, no line break is entered.
$ Logorst = mysqli_query ($ cnn, "select * from BandLogo where ShowOrder <> '0' order by ShowOrder ASC ");
?>
While ($ row = mysqli_fetch_array ($ logorst )){If ($ picindex> $ rownum ){$ Picindex = 1;$ Newrow = 1;}If ($ newrow = 1 ){Echo"
"; // Output
Line Feed}?>
| If ($ newrow = 1 ){Echo"
";$ Newrow = 0;}$ Picindex ++;}?>
The code above requires five icons to be displayed in each line, but starting from the second line, the line breaks after the first image is displayed. please help me to see if there is an error. thank you.
Reply to discussion (solution)
Your
If ($ newrow = 1 ){
Echo""; // OutputLine Feed
}
If ($ newrow = 1 ){
Echo"";
$ Newrow = 0;
}
It is completed in a loop. Naturally, there is only one cell in the row.
Incomplete tags
If ($ picindex> $ rownum ){
$ Picindex = 1;
$ Newrow = 1;
}
The first five times $ picindex must be less than $ rownum, that is, at the beginning, there is noStart Tag
Change
If ($ picindex> $ rownum) {$ picindex = 1;} if ($ picindex = 1) {echo""; // OutputThat is, line feed}?>
";}$ Picindex ++;
Jam00
The jam is delicious,
If ($ picindex = $ rownum ){
Echo"";
}
Only $ picindex = $ rownum can be input.