How to Read database from the php drop-down menu

Source: Internet
Author: User
How to Read database from the php drop-down menu how to read database from the php drop-down menu


Now you can click the line to find the line from the database, but you want to read the vehicle through the selected line

Table line
Linename
213
223
225
267


Table busname
Linename busname
213 781
213 782
213 783
223 817
223 818
225 901
267 100





The code is as follows:

Select line



$ Link = mysql_connect ("127.0.0.1", "root", "12345678 ");If (! $ Link) echo "no connection successful! ";Mysql_select_db ("busap", $ link); // select a database// Control query conditions$ Q = "SELECT * FROM line order by linename asc ";Mysql_query ("set names GB2312"); // prevents garbled characters$ Rs = mysql_query ($ q); // Obtain a dataset$ Assoc = mysql_num_rows ($ rs); // The number of affected rows. mysql_fetch_assoc was used.$ Row = mysql_fetch_array ($ rs); // you only need to add this row back.$ Xl = $ row [linename]?> Select line



Vehicle ID



$ Link = mysql_connect ("127.0.0.1", "root", "12345678 ");If (! $ Link) echo "no connection successful! ";Mysql_select_db ("busap", $ link); // select a database// Control query conditions$ Q = "SELECT * FROM '{$ _ REQUEST ['select']} 'Order BY linename asc ";Mysql_query ("set names GB2312"); // prevents garbled characters$ Rs = mysql_query ($ q); // Obtain a dataset$ Assoc = mysql_num_rows ($ rs); // The number of affected rows. mysql_fetch_assoc was used.$ Row1 = mysql_fetch_array ($ rs); // you only need to add this row.?> Select vehicle


Reply to discussion (solution)

      

Select line

Select line

Vehicle ID

Select vehicle

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.