How to solve this problem through loop-php Tutorial

Source: Internet
Author: User
The cycle turns Dizzy & lt ;? Php & nbsp; $ SQL & quot; select * fromhrefwhereid $ idorderbylink & quot; & nbsp; $ querymysql_query ($ SQL); & nbsp; while ($ arraymysql_fetch_array ($ query )) {& nbsp ;? Cyclically dizzy
$ SQL = "select * from href where id = $ id order by link ";
$ Query = mysql_query ($ SQL );
While ($ array = mysql_fetch_array ($ query )){
?>
Src = "list. files/biao_33.gif" width = 11 align = absMiddle>


">





}?>

This is a big one, but I want to change it to this when ID is not 1 2.
$ SQL = "select * from href where id = $ id order by link ";
$ Query = mysql_query ($ SQL );
If ($ id! = 1 and $ id! = 2 ){
While ($ array = mysql_fetch_array ($ query )){
?>
Src = "list. files/biao_33.gif" width = 11 align = absMiddle>


">





}}
?>

Elseif ($ id = 1 ){

Src = "list. files/biao_33.gif" width = 11 align = absMiddle>


">








}
Elseif ($ id = 2 ){

Src = "list. files/biao_33.gif" width = 11 align = absMiddle>


">








}


How can I get dizzy in that loop? Actually, I don't know. Where should I put this? I 've tried several times and it's not big.



------ Solution --------------------
$ Array {"link "};? Where did you see this? Incorrect. It should be $ array ["link"], enclosed in square brackets
We recommend that you use a professional editor, such as notepad ++ and eclipse, to highlight PHP syntax. In addition, the switch statement is more suitable for your situation.
PHP code
        ">
                    
        ">
                      
        ">
                        
  

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.