Php loop error

Source: Internet
Author: User
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.

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.