Jump to content

The page isn't redirecting properly


doubledee

Recommended Posts

My website has been working just fine, and I negated a condition to trigger an error message, and now I keep getting this...

The page isn't redirecting properly

 

Here is the file I am working with...

<?php //Build Date: 2012-03-10

// ************************
// Update Last Activity.	*
// ************************
if ((isset($_SESSION['loggedIn'])) && ($_SESSION['loggedIn'] == TRUE)){
	// Initialize variables.
	$loggedIn = 1;
	$memberID = (isset($_SESSION['memberID']) ? $_SESSION['memberID'] : '');


	// ************************
	// Update Member Record.	*
	// ************************

	// Connect to the database.
	require_once(WEB_ROOT . 'private/mysqli_connect.php');

	// Build query.
	$q = "UPDATE member
					SET logged_in=?,
							last_activity=now()
					WHERE id=?
					LIMIT 1";

	// Prepare statement.
	$stmt = mysqli_prepare($dbc, $q);

	// Bind variables to query.
	mysqli_stmt_bind_param($stmt, 'ii', $loggedIn, $memberID);


	// Execute query.
	$success = mysqli_stmt_execute($stmt);

	// Verify Update.
	if ($success === FALSE){
		// Update Failed.
		$_SESSION['resultsCode'] = 'MEMBER_UPDATE_FAILED_2126';

		// Redirect to Display Outcome.
		header("Location: " . BASE_URL . "/members/results.php");

		// End script.
		exit();
	}

/*
	$affectedRows = mysqli_stmt_affected_rows($stmt);

	echo $affectedRows;
	exit();

	// Verify Update.
	if ($affectedRows!==1){
//echo mysqli_stmt_affected_rows($stmt);
//exit();

		// Update Failed.
		$_SESSION['resultsCode'] = 'MEMBER_UPDATE_FAILED_2126';

		// Redirect to Display Outcome.
		header("Location: " . BASE_URL . "/members/results.php");

		// End script.
		exit();
	}//End of UPDATE MEMBER RECORD
*/

	// Close prepared statement.
	mysqli_stmt_close($stmt);

	// Close the connection.
//		mysqli_close($dbc);
}//End of UPDATE LAST ACTIVITY

?>

 

This file is included by all other pages so that as a User navigates my site I am constantly updating the "last_activity" field in the database.

 

If I change the condition from...

		if ($success === FALSE){

 

...to...

		if ($success !== FALSE){

 

...then I get this error?!

 

 

(Where I am at, the Internet is on and offline.  Could that be a factor??)

 

I am REALLY CONFUSED what is happening here...  :shrug:

 

 

Debbie

 

Link to comment
https://forums.phpfreaks.com/topic/259666-the-page-isnt-redirecting-properly/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.