我已选择了数据库,但出于某种奇怪的原因,它仍然显示未选择。
连接行:
$location = "localhost";
$user = "user";
$pass = "pass";
//Database Selection
$link = mysql_connect($location, $user, $pass);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
//Database Selection
mysql_select_db('database') or die(mysql_error());
查询语句:
while ($row_fpages = mysql_fetch_array($result_fanpage))
{
if ( $row_fpages['client'] == NULL ) {
//GRAPHS
$sql = "SELECT date, likes FROM statistics_pages WHERE idnum='".$_COOKIE['id']."' AND page_name = ".$row_fpages['page_name']." LIMIT 7";
$result_apps = mysql_query($sql) or die(mysql_error());
错误信息是:No database selected
。
我之前从未遇到过这个错误,尝试了很多方法但都没有解决问题。