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 );