How php calls mysql data

Source: Internet
Author: User
Php calls mysql data. his mysql database a123456 contains a table team table with some fields: id, title, and now_number. how can I use php to call the IDs of six mysql data records, title and other data, sorted by the size of now_number. Learn from new users. Thank you. ------ Solution --------------------... $ sqlSELECT * php calls mysql data
He has a mysql database a123456.
There is a table team
Some fields in the table: id, title, now_number

How to use php to call the id, title, and other data in six mysql data records, sorted by the size of now_number.


Learn from new users. Thank you.

------ Solution --------------------
...
$ SQL = 'select * FROM team order by now_number desc limit 0, 6 ';
$ Res = mysql_query ($ SQL );
While ($ row = mysql_fetch_array ($ res )){
Echo "ID:". $ row ['id']. "TT:". $ row ['title']."
";
}
------ Solution --------------------
....
$ Db = mysql_pconnect ($ dbhost, $ dbuser, $ dbpassword) or die ("Connection Error :". mysql_error (); // link to the database. the parameters are mysql host (localhost), user name, and password.
Mysql_select_db ('a123456') or die ("Error conecting to db."); // select a database
$ SQL = 'select * from team order by now_number desc limit 0, 6 ';
$ Result = mysql_query ($ SQL );
$ Row = mysql_fetch_array ($ result, MYSQL_ASSOC );
$ Id = $ row ["id"];
$ Title = $ row ["title"];
....

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.