Jump to content

header not redirecting


droidus

Recommended Posts

why won't this header redirect?  it doesn't seem to like the mysql_close.  can i update the database before redirecting to another page?  is it possible?

 

<?php
session_start();
$name = "uname";
$lastLogin = date('l jS \of F Y h:i:s A');
require_once('../Connections/uploader.php');
mysql_select_db($database_uploader, $uploader); 
$query = "SELECT * FROM members WHERE uname='"
. $name . "'";
$result = mysql_query($query) or die(mysql_error());
// connect to database here
					MYSQL_CONNECT($server, $user, $password) or die ("Server unreachable");
					MYSQL_SELECT_DB($database) or die ("Database non existent");
					if (mysql_num_rows($result) > 0) { 
	$row = mysql_fetch_array($result) or die(mysql_error());
	mysql_query("UPDATE members
					SET lastLogin='$lastLogin'
					WHERE uname='$name'")
					// ERROR MESSAGE??
					or die(mysql_error());  
					mysql_close($con);
					header('Location: redirect.php');
					}

?>

 

thanks in advance.

Link to comment
Share on other sites

you're missing a semi-colon after:

mysql_query("UPDATE members SET lastLogin='$lastLogin' WHERE uname='$name'")

 

also, in this line:

mysql_close($con);

 

where does $con come from? you seem to be connecting to mysql without storing the resource in a variable (unless it's in uploader.php)...

you're probably getting a warning about that, but you can surpress it with the @ sign (if you just want a quick fix to test things):

@mysql_close();

Link to comment
Share on other sites

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.