PHP MySQL Connection database Select Show All tables _php tutorial

Source: Internet
Author: User
Tags php mysql
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 ...

  • 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.