Here is mainly about the database connection in PHP and database selection and display the current database all tables three practical functions, there is a need for friends to see.
Here is the main talk about the database tutorial in PHP Tutorial connection with database selection and display the current database all tables three utility functions, there is a need for friends to see.
$phps Tutorial Ql_user = "root";
$phpsql _password = "root";
$phpsql _loc = "";
$phpsql _db = "";
function Phpsql_connect ($location, $username, $password) {
Global $phpsql _loc, $phpsql _user, $phpsql _password;
if ($phpsql _user! = $username | | $phpsql _password! = $password)
Phpsql_error ("Cannot access to phpsql! ( Wrong username/wrong password) ");
Define (Phpsql_loc, $location);
$phpsql _loc = $location;
}
function phpsql_select_db ($db) {
Global $phpsql _db;
Define (phpsql_db, $db);
$phpsql _db = $db;
}
function phpsql_list_table () {
Global $phpsql _loc, $phpsql _db;
$i = 0;
if (! ( $handle = @opendir ($phpsql _loc. " /". $phpsql _db)))
return 0;
while (($file = Readdir ($handle))!== false) {
if ($file! = "." && $file! = "...")
{
$table [$i + +] = $file;
}
}
return $table;
}
http://www.bkjia.com/PHPjc/630778.html www.bkjia.com true http://www.bkjia.com/PHPjc/630778.html techarticle here is mainly about the database connection in PHP and database selection and display the current database all tables three practical functions, there is a need for friends to see. Here is the main talk about ...