CBaZ Posted July 2, 2008 Share Posted July 2, 2008 I am inserting with this script but not deleting still have tryed various things not sure as to why its not deleting yet. any help greatly appreciated. <?php include("dbinfo.php"); global $HTTP_SERVER_VARS; // Set length of session to twenty minutes define("SESSION_LENGTH", 20); $userIP = $HTTP_SERVER_VARS["REMOTE_ADDR"]; $sConn = @mysql_connect($dbServer, $dbUser, $dbPass) or die("Couldnt connect to database"); $dbConn = @mysql_select_db($dbName, $sConn) or die("Couldnt select database $dbName"); $timeMax = time() - (60 * "SESSION_LENGTH"); $result = mysql_query("select count(*) from usersOnline where unix_timestamp(dateAdded) >= '$timeMax' and userIP = '$userIP'"); $recordExists = mysql_result($result, 0, 0) > 0 ? true : false; if(!$recordExists) $usersonline = mysql_num_rows($recordExists); { // Add a record for this user @mysql_query("INSERT INTO usersOnline(userIP, username, permission, user_id) values ('$userIP', '$_SESSION[username]', '$_SESSION[permission]', '$_SESSION[id]')"); @mysql_query("DELETE FROM usersOnline WHERE dateAdded < $timeMax"); mysql_close(); return $usersonline; } ?> Link to comment https://forums.phpfreaks.com/topic/112857-deleting-the-row-from-mysql/ Share on other sites More sharing options...
.josh Posted July 2, 2008 Share Posted July 2, 2008 Your original thread was moved to 3rd party scripts, because you mentioned it was a 3rd party script. Please do not make multiple threads asking the same thing. Thread closed. Link to comment https://forums.phpfreaks.com/topic/112857-deleting-the-row-from-mysql/#findComment-579675 Share on other sites More sharing options...
Recommended Posts