一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

php mysql 连接 数据库选择 显示所有表

时间:2022-06-24 19:05:10 编辑:袖梨 来源:一聚教程网

$phps教程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;
}

热门栏目