What is the old problem of changing colors in different lines? To enable the function of changing the color of the line on the webpage, I used the second method below. Theoretically, it is okay. The result is all in one color. I checked it later, there is also the first method, which is quite useful. I just want to know that there is a problem in the second method, and I am very confused. I used to do this. I checked a lot of information and didn't explain it in detail. please advise me ...... PHPcode method 1 while ($ resultmysql_fetch_ar is the old problem of changing the color of the line?
To enable the function of changing the color of the line on the webpage, I used the second method below. Theoretically, it is okay. The result is all in one color. I checked it later, there is also the first method, which is quite useful.
I just want to know that there is a problem in the second method, and I am very confused. I used to do this. I checked a lot of information and didn't explain it in detail. please advise me ......
PHP code
// Method 1 while ($ result = mysql_fetch_array ($ query) {$ bgcolor = ($ bgcolor = "blue ")? "White": "blue"; echo""; Echo"{$ Result ['gname']}"; Echo"{$ Result ['endtime']}"; Echo"{$ Result ['current _ price']}"; Echo"{$ Result ['reply _ num']}"; Echo"";}// Method 2 $ flag = 1; while ($ result = mysql_fetch_array ($ query) {if ($ flag % 2 = 0) $ bgcolor = "yellow"; else $ bgbolor = "white"; // This method can theoretically be echo""; Echo"{$ Result ['gname']}"; Echo"{$ Result ['endtime']}"; Echo"{$ Result ['current _ price']}"; Echo"{$ Result ['reply _ num']}"; Echo""; $ Flag ++ ;}
------ Solution --------------------
Why don't jquery do it on the front end ?? Code remainder efficiency is a problem
------ Solution --------------------
If ($ flag % 2 = 0) $ bgcolor = "yellow"; else $ bgbolor = "white ";
$ Bgcolor !!!
I wrote something wrong. who is the blame?
------ Solution --------------------
Output $ flag % 2 first
Echo $ flag % 2; echo'
';
Check whether the x0x0x0x0x0 format is correct. If yes. Check whether it is a css style problem.
Style = "background: Color"
------ Solution --------------------
Discussion
If ($ flag % 2 = 0) $ bgcolor = "yellow"; else $ bgbolor = "white ";
$ Bgcolor !!!
I wrote something wrong. who is the blame?