-1
<?php
$dbcon=mysqli_connect("localhost","root","","simple_login");
mysqli_select_db($dbcon,"");
?>
上面的代碼是在db_conection.php沒有mysqli的數據庫中選擇錯誤
在另一個文件中我嘗試accesss稱爲校表
if(!$_SESSION['username'])
{
header("Location: index.php");//redirect to login page to secure the welcome page without login access.
}
else
{
$user=$_SESSION['username'];
require('db_conection.php');
$ex0=mysql_query("SELECT * FROM school WHERE uid='$user'") or die(mysql_error());
$count=mysql_num_rows($ex0);
if($count)
{
echo '<script>';
echo 'alert("Profile there");';
echo '</script>';
}
}
?>
即使需要()之後,它會引發錯誤未選擇數據庫。請幫忙。
所以,**選擇一個數據庫**吧? http://php.net/manual/en/mysqli.select-db.php –
可能重複[沒有數據庫選擇錯誤信息](http://stackoverflow.com/questions/16418870/no-database-selected-error -信息) –