PHP solves an endless loop caused by compressed code _ PHP Tutorial

Source: Internet
Author: User
PHP solves an endless loop caused by compressed code. Requirements for idstr1str21saabbb2saabbc3sss123 in the test. table1 table: the content of "str1" is not repeated. It would have been quite simple, but I think the code can be compressed.
Test. table1 table
Id Str1 Str2
1 Saa Bbb
2 Saa Bbc
3 Sss 123

Requirement: the content of the "str1" section is not repeated.
It would have been a few simple lines, but I think the code can be compressed, which looks more concentrated, so the Cup will happen. the error code is as follows:
 ";}?>

Do you see the problem at first glance? This product actually triggers an endless loop... T_T

So I restored it step by step, and the endless loop disappeared. Obviously, it is not a problem to submit statements. it should be a problem with the syntax structure.

Sure enough, the problem lies in while. Each time a condition is detected, mysql_query is executed. Then the cup is ready.

The correct code is as follows:

 ";}?>

Code optimization, the first of all evil ...... Calm down, calm down!

Required id str1 str2 1 saa bbb 2 saa bbc 3 sss 123 requirement: the content of the "str1" segment is not repeated. It would have been quite simple, but I think the code can be compressed...

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.