The solution to the cyclic halo

Source: Internet
Author: User
The loop is spinning.
$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>


">





}?>

It's a big one, but I'd like to change it when the ID's not 1 2, so then here
$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 to put it in that loop and get dizzy. Actually, I don't know. Where should I put it? I've tried several places.



------Solution--------------------
$array {"link"};? Where did you read that? The wrong. It should be $array["link", enclosed in square brackets.
It is recommended that you change to a professional editor, such as Notepad++,eclipse, which can be highlighted in PHP syntax. In addition, the switch statement is more appropriate for your situation.
PHP code
!--? PHP $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)) {?--">                               !--? php echo $array ["link"];?--"!--? php}//corresponding while}//corresponding if else if ($id ==1) {//2?-- ">!--? php echo $array [" link "];?--"!--? php}/ /corresponds to the else if ($id ==1)//2 else if ($id ==2) {//3?--">"!--? PHP EC
Ho $array ["link"];?--"!--? php}//corresponding ElseIf 3?--> 
  • 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.