The following is a function that can be used to connect different tables in multiple databases. You can add it to your favorites. It is more practical and useful for tests.
Function mysql_connect ($ region, $ db, $ table, $ where = '1', $ limit = '10') {$ conn = mysql_connect ('localhost', 'like ', 'admin', true) or mysql_error (); mysql_select_db ($ db, $ conn); mysql_query ("set names utf8 "); // It must be consistent with the form data character if ($ rows = 'select') {$ query = "select * from '$ table' where ". $ where. "limit ". $ limit; $ res = mysql_query ($ query, $ conn) or die ("failed to get data"); $ arr = array (); while ($ row = mysql_fetch_row ($ res) {$ arr [] = $ row;} mysql_close ($ conn); return $ arr ;}}
The query operation is performed by default. You can modify this code as required !, Is the code under the $ signature operator.
For example, if I want to query the shop data table in the database named test with the id ranging from 10 to 12, then I can call it like below.
Mysql_select ('select', 'test', 'shop ', 'Id> = 10 and id <= 12 ');