Jump to content

deleting the row from mysql


CBaZ

Recommended Posts

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
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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.