CodeMama Posted January 30, 2009 Share Posted January 30, 2009 Help I can't get the AdminID session to set and pick up the AdminID from the db <?php //start session session_start(); //db connection include include("inc/dbconn_open.php") ; //errors on error_reporting(E_ALL); ini_set('display_errors', '1'); if (isset($_POST['UserName'])) {$UserName = $_POST['UserName'];} else {$UserName = '';} if (isset($_POST['Password'])) {$Password = $_POST['Password'];} else {$Password = '';} $msg = ''; if (!empty($UserName)) { $sql = "SELECT `AdminID`,`UserName` FROM `admin` WHERE `UserName`='$UserName' and `Password`='$Password'"; $result = mysql_query ($sql); $row = mysql_fetch_object ($result); if(isset($_SESSION['AdminID'])) $_SESSION['AdminID'] = $_SESSION['AdminID']; else $_SESSION['AdminID'] = $AdminID; If (mysql_num_rows($result) > 0) { $_SESSION['AdminLogin'] = true; $_SESSION['user']=$UserName; $_SESSION['AdminID']=$AdminID; header ('Location: Main.php'); Link to comment https://forums.phpfreaks.com/topic/143188-need-help-with-syntax-setting-session/ Share on other sites More sharing options...
dennismonsewicz Posted January 30, 2009 Share Posted January 30, 2009 put an or die after your sql $result = mysql_query ($sql)or die(mysql_error()); see what happens Link to comment https://forums.phpfreaks.com/topic/143188-need-help-with-syntax-setting-session/#findComment-750989 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.