堆栈跟踪:#0 {main}

时间:2017-06-23 14:31:53

标签: php mysql database connect

它在php错误日志中显示此错误,

  

PHP致命错误:未捕获错误:调用未定义的函数   /Applications/MAMP/htdocs/Filmmaker/connect.php:10中的mysql_connect()   堆栈跟踪:抛出0 {main}   第10行/Applications/MAMP/htdocs/Filmmaker/connect.php

表示第10行,即:

<?php

$database = array();
$database['host'] = "localhost";
$database['port'] = '8889';
$database['name'] = "forum";
$database['username'] = "root";
$database['password'] = "root";
//this is line 10 below
$link = mysql_connect($database['host'], $database['username'], 
$database['password']);

if($link) {
echo "Successfully connected to database: ".$database['name']."";
} else {
echo "Connect to database: ".database['name']."failed";
echo "Error: ".mysql_error();
}

?>

0 个答案:

没有答案