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"];
....