我想讓我的config.php文件工作,但每次我用它與我的login.php它只是給我一個白頁,而不是繼續通過我的login.php文件對我的成員.php頁面。我把我的連接信息放到我的login.php腳本中,它正常工作,下面列出了我一直在努力做的事情。PHP包括不工作
的config.php
<?php
$con = mysql_connect("mysql","DBUSER","DBPASS");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("DBNAME", $con);
/* WHAT I ORIGINALLY WANTED TO USE
$localhost = "mysql";
$dbuser = "DBUSER";
$dbpass = "DBPASS";
$dbname = "DBNAME";
$connect = mysql_connect($localhost, $dbuser, $dbpass);
mysql_select_db("$dbname", $connect);
*/
?>
的login.php
<?php
// I ALSO USED includes"config.php";
require("config.php");
$username = $_POST['username'];
$password = $_POST['password'];
$query = mysql_query("SELECT * FROM member WHERE username = '$username' AND password = '$password'");
$data = mysql_fetch_assoc($query);
if(mysql_num_rows($query)){
session_start();
$_SESSION['username'] = $data['username'];
header("Location: members.php");
exit;
}
header("Location: index.php");
?>
我是新來的PHP,所以不要在我的代碼笑的幫助,請感謝!
死亡=錯誤的白頁,但你有錯誤檢查關閉或不顯示。 – 2012-10-10 23:58:12
有沒有錯誤?檢查你的錯誤日誌 –
includes include'include(「config.php」);'http://php.net/manual/en/function.include.php – Jason