PHP reading Database Display problems

Source: Internet
Author: User
For more information about how to use PHP to read databases, see my database data: --- & nbsp; TABLE structure & nbsp; '3G _ district '-- CREATE & nbsp; TABLE & nbsp; IF & nbsp; NOT & nbsp; EXISTS & nbsp; '3G _ district '& nbsp;
My database data is as follows :-
-- Table structure '3G _ district'
--

Create table if not exists '3G _ district '(
'D _ id' mediumint (8) unsigned not null AUTO_INCREMENT,
'D _ name' char (255) not null,
'D _ level 'tinyint (4) unsigned not null default '0 ',
'D _ pid 'mediumint (8) unsigned not null default '0 ',
'D _ list 'smallint (6) not null default '0 ',
Primary key ('d _ id '),
KEY 'upid '('d _ pid', 'd _ list ')
) ENGINE = InnoDB default charset = utf8 AUTO_INCREMENT = 45052;

--
-- The data in the table is '3G _ district'
--

Insert into '3G _ district '('d _ id', 'd _ name', 'd _ level', 'd _ pid, 'd _ list') VALUES
(1, 'Beijing', 1, 0, 0 ),
(2, 'Tianjin city ', 1, 0, 0 ),
(3, 'hebei province ', 1, 0, 0 ),
(4, 'Shanxi E', 1, 0, 0 ),
(5, 'Inner Mongolia ', 1, 0, 0 ),
(6, 'Liaoning province ', 1, 0, 0 ),
(7, 'Jilin province ', 1, 0, 0 ),
(8, 'heilongjiang province ', 1, 0, 0 ),
(9, 'Shanghai', 1, 0, 0 ),
(10, 'Jiangsu province ', 1, 0, 0 ),
(11, 'Zhejiang province ', 1, 0, 0 ),
(12, 'Anhui province ', 1, 0, 0 ),
(13, 'Fujian province ', 1, 0, 0 ),
(14, 'jiangxi province ', 1, 0, 0 ),
(15, 'Shandong province ', 1, 0, 0 ),
(16, 'Henan province ', 1, 0, 0 ),
(17, 'hubei province ', 1, 0, 0 ),
(18, 'hunan province ', 1, 0, 0 ),
(19, 'Guangdong province ', 1, 0, 0 ),
(20, 'Guangxi Zhuang autonomous region ', 1, 0, 0 ),
(21, 'Hainan ', 1, 0, 0 ),
(22, 'Chongqing ', 1, 0, 0 ),
(23, 'Sichuan province, 1, 0, 0 ),


My conn. php file is as follows:


$ Mysql_server_name = "localhost"; // database server name
$ Mysql_username = "root"; // User name used to connect to the database
$ Mysql_password = ""; // connection password
$ Mysql_database = "teafea"; // database name

// Connect to the database
$ Conn = mysql_connect ($ mysql_server_name, $ mysql_username, $ mysql_password );

// Use utf8 encoding
Mysql_query ("set names 'utf8 '");

// SQL statement used to extract information from the table
$ Str = "select d_id, d_name from region _district ";

// Execute SQL query
Mysql_select_db ($ mysql_database, $ conn );
$ Res = mysql_query ($ str, $ conn );

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.