droidus Posted August 24, 2011 Share Posted August 24, 2011 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 https://forums.phpfreaks.com/topic/245558-header-not-redirecting/ Share on other sites More sharing options...
voip03 Posted August 24, 2011 Share Posted August 24, 2011 Two database connection ? can i update the database before redirecting to another page? Yes you can. Link to comment https://forums.phpfreaks.com/topic/245558-header-not-redirecting/#findComment-1261230 Share on other sites More sharing options...
WebStyles Posted August 24, 2011 Share Posted August 24, 2011 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 https://forums.phpfreaks.com/topic/245558-header-not-redirecting/#findComment-1261234 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.