我創建了一個在本地主機上正常工作的PHP網站,但是當我在服務器上上傳相同的代碼時,它向我展示服務器上的空白頁。頁面在本地主機上正常工作,但未在託管服務器上運行
問題我懷疑我的代碼中的任何地方我使用了數據庫連接(dbc.php)我的頁面變得空白。當我刪除該數據庫連接代碼時,它會很好。
我把登錄代碼和dbc.php。
我的login.php中碼
<?php
include('dbc.php');
// get form data, making sure it is valid
$phone = mysql_real_escape_string(htmlspecialchars($_POST['id']));
$pass = mysql_real_escape_string(htmlspecialchars($_POST['password']));
// check to make sure both fields are entered
if ($phone == '' || $pass == '')
{
// generate error message
$error = 'ERROR: Please fill in all required fields!';
// if either field is blank, display the form again
header("Location: " .$_SERVER['HTTP_REFERER']);
}
else
{
// save the data to the database
$login_sql=mysql_query("select * from member where email='$phone' and password='$pass'")
or die(mysql_error());
$num=mysql_num_rows($login_sql);
if($num>0)
{
session_start();
$admin_data=mysql_fetch_array($login_sql);
$_SESSION['usermatri_id']=$admin_data['mid'];
if($admin_data['mid']>0)
{
header("Location: dashboard.php");
}
else
{
header("location:".$_SERVER["HTTP_REFERER"]);
}
exit;
}
else{
header("location:".$_SERVER["HTTP_REFERER"]);
}
}
// if the form hasn't been submitted, display the form
?>
我對dbc.php
<?php
//connection to the database
mysql_connect("localhost","root","")or die(mysql_error('cannot connect'));
mysql_select_db("matrimony");
?>
1)我想這些問題,但不工作,
代碼PHP redirect not working on server
2)我試圖添加錯誤檢查也沒有什麼會顯示在網頁上,甚至嘗試通過cPanel錯誤日誌。
ini_set('display_errors',1);
error_reporting(E_ALL);
嘿男人你得到身份證,並將其分配給電話,然後使用它對電子郵件字段來檢查記錄。這是總的混亂 –
看看這是否有幫助。 mysql擴展在php 5.5中被棄用http://php.net/manual/en/function.mysql-select-db.php – Patrick
什麼是你的PHP版本?你能告訴我你的phpinfo() –