在/ BlueHost的PARTH/index.php文件上传我的网站和数据库到cPanel bluehost当我通过下面的代码连接数据库时显示错误:警告:包括():打开失败 'PARTH' 列入(include_path中= ':/选择/ php70/lib中/ PHP的')在第3行
Warning:include():在/ bluehost中打开'parth'包含(include_path ='。:/ opt/php70/lib/php')失败在 线PARTH/index.php的3
因此所有开发者帮助解决我的这个错误...
DB配置
<?php
/*
* All database connection variables
*/
$host="localhost";
$username="root";
$password="";
$dbname="db_name";
$connection=mysql_pconnect($host,$username,$password) or die("connection to the server fail".mysql_error());
mysql_select_db($dbname, $connection) or die("could not open db:$dbname");
function db_connect()
{
if(!$connection)
{
return false;
}
if(!mysql_select_db($dbname, $connection))
{
return false;
}
return $connection;
}
function login($user,$pass)
{
db_connect();
$result = mysql_query("SELECT * FROM user WHERE username = '".$user."' AND password = '".$pass."'");
$num_rows = mysql_num_rows($result);
if($num_rows < 1) return false;
mysql_free_result($result);
return true;
}
mysql_query("SET CHARACTER SET 'utf8'");
mysql_query("SET SESSION collation_connection ='utf8_general_ci'");
?>
include connection db
<?php
包括连接DB
<?php
/*
* I upload my site and database in to cPanel bluehost When me connection database by code below it show error:
*/
//error_reporting(E_ERROR|E_PARSE);
include 'atsschool/db_function.php';
if(empty($_GET['p']))
{
$_GET['p']='home';
}
if(empty($_GET['page']))
{
$_GET['page']='1';
}
if(empty($_GET['l']))
{
$_GET['l']='english';
}
?>
警告:include():在/home1/hotelkci/public_html/atsschool/index.php中打开'atsschool/db_function.php'以包含(include_path ='。:/ opt/php70/lib/php')失败在第3行 –
我想第二个文件是index.php,在这种情况下,它在与'db_function.php'文件相同的目录中。你需要引用它作为刚'包括“db_function.php”;'或者'包括“../ atsschool/db_function.php”;' – mbozwood