5) int mysql_data_seek (int result_id, int row_num );
Each result set returned by the SELECT query has a row cursor, indicating the row to be returned by the next function (mysql_fetch_array (), mysql_fetch_object (), or mysql_fetch_row () to extract the row. Mysql_data_seek () sets the pointer of the given result set to the given row. The row number ranges from 0 to mysql_num_rows ()-1. If the row number is valid, mysql_data_seek () returns true; otherwise, false.
<? Php
$ Link = mysql_pconnect ("localhost", "sunsoft", "suixiang") or die ("cocould not connect ");
Mysql_select_db ("samp_db") or die ("cocould not select database ");
$ Query = "SELECT last_name, first_name FROM president ");
$ Result = mysql_query ($ query) or die ("Query failed ");
For ($ I = mysql_num_rows ($ result)-1; $ I> = 0; $ I -)
{
If (! Mysql_data_seek ($ result, $ I );
{
Printf ("Cannot seek to row % dn", $ I );
Continue;
}
If (! $ Row = mysql_fetch_object ($ result )))
Continue;
Printf ("% d % s <BR> n", $ row-> last_name, $ row-> first_name );
}
Mysql_free_result ($ result );
?>
(6) int mysql_db_query (string db_name, string query [, int link_id]);
In addition to extracting an additional database name parameter, mysql_db_query () makes it the default database before executing the query, similar to mysql_query.
<? Php
$ Link = mysql_pconnect ("localhost", "sunsoft", "suixiang") or die ("cocould not connect ");
Print ("Connected successfully ");
$ Query = "SELECT * FROM president ";
$ Result = mysql_db_query ("samp_db", $ query) or die ("Query failed ");
?>
(7) int mysql_drop_db (string db_name, int [link_id]);
Tells the MySQL server identified by link_id to delete the database with the given name. If the database is successfully deleted, true is returned. If an error occurs, false is returned. You must have the DROP permission to delete the database.
Be careful with this function. If you delete a database, it does not exist and cannot be recovered.
Mysql_query () is more suitable for publishing the drop database statement using mysql_drop_db.
<? Php
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