Jump to content

Error in Code, going to white screen and not redirecting


Recommended Posts

Keep going over this and can't find the stupid error. Need some fresh eyes for some help. Thanks

 


<?php

ob_start();
session_start();
include("include/db_connect.php");



// Define $username and $password 

$username = $_REQUEST['username']; 
$password = $_REQUEST['password'];



// To protect MySQL injection
$username = stripslashes($username);
$password = stripslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);

$sql="SELECT * FROM login WHERE username = '$username' AND password = '$password'";
$result=mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_array($result); 


// Mysql_num_row is counting table row

    $count=mysql_num_rows($result);

// If result matched, table row must be 1 row

if($count!=0)
{
	// Register session variables and redirect to file "dashboard.php"

	  
	$_SESSION['id'] = $row['id'];
	$_SESSION['franchise_id'] = $row['franchise_id'];
	$_SESSION['dealer_id'] = $row['dealer_id]';
	$_SESSION['first'] = $row['first'];
	$_SESSION['last'] = $row['last'];

	header("location:dashboard.php");
}
else
{
	header("location:not_logged_in.php");
}

ob_end_flush();

?>

You have a fatal php parse error on line 41. You need to have php's error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php will report and display all the errors it detects. You will save a TON of time.

 

I didn't mention what the error message is or what is causing it (it is actually fairly obvious to find when you know the general area in the code to start looking), because learning to find and fix errors in programming is as important a skill to have as being able to write code.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.