PHP + MYSQL Query Database Luo Zhi system is very difficult

Source: Internet
Author: User
Query the database in PHP + MYSQL results in a very slow system! PHP code: & lt ;! DOCTYPE & nbsp; html & gt; & lt ;! -- STATUS & nbsp; OK -- & gt; & nbsp; & lt; html & gt; & lt; head & gt; & lt; meta & nb PHP + MYSQL queries the database, causing the system to become very difficult!
PHP code:









$ Dbh = @ mysql_connect ("localhost: 3306", "root", "123456 ");
 
/* Define the variable dbh. the mysql_connect () function means to connect to the mysql database, and "@" means to block the error */
If (! $ Dbh) {die ("error ");}
/* The die () function means to send the strings in brackets to the browser and interrupt the php program (script ). The parameters in the brackets are the strings to be sent. */
@ Mysql_select_db ("data", $ dbh );

Mysql_query ("set names data ");



?>











$ Wd = $ _ POST ["wd"];
/* Select a database on the mysql server. the database name is OK */
$ Q = "(select * from tabal where user like '$ wd %' or email LIKE '$ wd % ')
Union all
(Select * from tabal1 where user like '$ wd %' or email LIKE '$ wd % ')
Union all
(Select * from Tabal where user like '$ wd %' or email LIKE '$ wd % ')
Union all
(Select * from tab_3 where user like '$ wd %' or email LIKE '$ wd % ')
Union all
(Select * from tabal4 where user like '$ wd %' or email LIKE '$ wd % ')
Union all
(Select * from tabal5 where user like '$ wd %' or email LIKE '$ wd % ')
Union all
(Select * from tabal6 where user like '$ wd %' or email LIKE '$ wd % ')
Union all
(Select * from tabal7 where user like '$ wd %' or email LIKE '$ wd % ')
Union all
(Select * from tabal8 where user like '$ wd %' or email LIKE '$ wd % ')
Union all
(Select * from tabal9 where user like '$ wd %' or email LIKE '$ wd % ')
Union all
(Select * from tabal10 where email LIKE '$ wd % ')
Union all
(Select * from tabal11 where user like '$ wd %' or email LIKE '$ wd %') LIMIT 0, 20 ";

/* Define the variable q. "select * from abc" is an SQL statement that reads data in table abc */
?>





$ Rs = mysql_query ($ q, $ dbh );

While ($ row = mysql_fetch_array ($ rs ))

Echo" $ Row [user]  $ Row [pass]  $ Row [email]";

?>




 
@ Mysql_close ($ dbh );

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.