I created a PHP website which is working fine on my localhost but when I uploaded the same code on the server, it is showing me blank pages on the server.
Problem what I suspected is wherever in my code I used a database connection (dbc.php) my pages are getting blank. When I am removing that database connection code it is going fine .
I am putting login code and dbc.php.
My code for 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
?>
My Code for dbc.php
<?php
//connection to the database
mysql_connect("localhost","root","")or die(mysql_error('cannot connect'));
mysql_select_db("matrimony");
?>
1) I tried these questions, but not functioning
PHP redirect not working on server
2) I tried adding error check also, nothing is getting displayed on a webpage, even tried going through cPanel error log .
ini_set('display_errors',1);
error_reporting(E_ALL);