timmah1 Posted June 25, 2008 Share Posted June 25, 2008 Can anybody tell me why this inserts everything twice? <?php if(isset($_SESSION['SESS_LOGGEDIN']) == TRUE) { require("config.php"); $_SERVER['FULL_URL'] = 'http'; if($_SERVER['HTTPS']=='on'){$_SERVER['FULL_URL'] .= 's';} $_SERVER['FULL_URL'] .= '://'; if($_SERVER['SERVER_PORT']!='80') $_SERVER['FULL_URL'] .= $_SERVER['HTTP_HOST'].':'.$_SERVER['SERVER_PORT'].$_SERVER['SCRIPT_NAME']; else $_SERVER['FULL_URL'] .= $_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']; if($_SERVER['QUERY_STRING']>' '){$_SERVER['FULL_URL'] .= '?'.$_SERVER['QUERY_STRING'];} if($_SERVER['FULL_URL'] == $config_basedir."editInfo.php"){ $page = "edit info"; $action = "Edited personal and or company info"; } elseif($_SERVER['FULL_URL'] == $config_basedir."history.php"){ $page = "view history"; $action = "Viewed personal history"; } elseif($_SERVER['FULL_URL'] == $config_basedir."logout.php"){ $page = "logout"; $action = "Logged out of site"; } elseif($_POST['login']){ $page = "login"; $action = "Logged into site"; } elseif($_SERVER['FULL_URL'] == $config_basedir."index.php"){ $page = "home"; $action = "Went to home page"; } $history = "INSERT INTO history1(user_id, history_date, page, history, action) VALUES( '" .$_SESSION['SESS_USERID']. "', NOW(), '" .$_SERVER['FULL_URL']. "', '$page', '$action' ); "; mysql_query($history) or die("Sorry, there was a problem creating your history ".mysql_error()); } ?> Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/111857-solved-double-insertion-into-mysql/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.