我使用MySQL和我試圖做一個簡單的登錄到數據庫,但每當我嘗試這樣做,我得到一個錯誤
Notice: Undefined variable: db_hostname in D:\xampp\htdocs\index.php on line 3
Notice: Undefined variable: db_username in D:\xampp\htdocs\index.php on line 3
Notice: Undefined variable: db_password in D:\xampp\htdocs\index.php on line 3
這裏是我的代碼爲的index.php
<?php
require_once('login.php') ;
$db_server = mysql_connect($db_hostname, $db_username, $db_password);
if(!$db_server) die ("Unable to connect to MySQL: " . mysql_error());
?>
的login.php中
<?php//login.php
$db_hostname = 'localhost';
$db_database = 'publications';
$db_username = 'root';
$db_password = '';
?>
代碼,我不知道我做錯了。
非常感謝你哈哈! – frosty 2015-04-03 04:57:29