If statement skips this one executes the next statement how to write

Source: Internet
Author: User
Lots of data to write to the database

For example if ($a = = 2) {
Skip this one.
}

Code should be how to write, know the eldest brother directly to the complete code, thank you


Reply to discussion (solution)

if ($a! = 2) {
Skip this one.
}

This data is not written to the database when $a=2, continue to the next

if ($a! = 2) {
Implement this article
}

Continue in circulation

if ($a! = 2) {
mysql_query (' insert INTO ... ');
}

If it's in the body of the loop, continue.

foreach ($xxx as $x) {     if ($a = = 2) {           continue;//) If this requirement is met, the following statement within this loop will no longer perform the start of the next loop     }     mysql_query (" Xxxxxxxxxxxxxxxxxxxxxxxxxxxxx ");}

foreach ($xxx as $x) {     if ($a = = 2) {           continue;//) If this requirement is met, the following statement within this loop will no longer perform the start of the next loop     }     mysql_query (" Xxxxxxxxxxxxxxxxxxxxxxxxxxxxx ");}
++


The code you want is as follows:

if ($a = = 2) {}else{  //A Heap of code}

The code you want is as follows:

if ($a = = 2) {}else{  //A Heap of code}

++
Blank
  • 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.