axd
03-29-2009, 02:11 PM
Hello, kinda new to PHP and MYSQL, I have created a website through using tutorials. It works well but i need to edit a small section of code to allow for editing users, and am not sure of the correct mysql syntax (or php, tbh i am not sure which category this falls under, so if it should be in php I apologise in advance). On with the issue....
I have this code....
/**
* procDeleteInactive - All inactive users are deleted from
* the database, not including administrators. Inactivity
* is defined by the number of days specified that have
* gone by that the user has not logged in.
*/
function procDeleteInactive(){
global $session, $database;
$inact_time = $session->time - $_POST['inactdays']*24*60*60;
$q = "DELETE FROM ".TBL_USERS." WHERE timestamp < $inact_time "
."AND userlevel != ".ADMIN_LEVEL;
$database->query($q);
header("Location: ".$session->referrer);
I am trying to add another user level to be ignored when deleting inactive users. The user level is called PREMIUM_LEVEL, but i am unsure of the correct way to add it after the
$q = "DELETE FROM ".TBL_USERS." WHERE timestamp < $inact_time "
."AND userlevel != ".ADMIN_LEVEL;
I have the PREMIUM_LEVEL etc all set up, i just need advice on adding it to the end of this statement, so it ignores both ADMIN_LEVEL and PREMIUM_LEVEL
Many thanks to all who reply
Dan
I have this code....
/**
* procDeleteInactive - All inactive users are deleted from
* the database, not including administrators. Inactivity
* is defined by the number of days specified that have
* gone by that the user has not logged in.
*/
function procDeleteInactive(){
global $session, $database;
$inact_time = $session->time - $_POST['inactdays']*24*60*60;
$q = "DELETE FROM ".TBL_USERS." WHERE timestamp < $inact_time "
."AND userlevel != ".ADMIN_LEVEL;
$database->query($q);
header("Location: ".$session->referrer);
I am trying to add another user level to be ignored when deleting inactive users. The user level is called PREMIUM_LEVEL, but i am unsure of the correct way to add it after the
$q = "DELETE FROM ".TBL_USERS." WHERE timestamp < $inact_time "
."AND userlevel != ".ADMIN_LEVEL;
I have the PREMIUM_LEVEL etc all set up, i just need advice on adding it to the end of this statement, so it ignores both ADMIN_LEVEL and PREMIUM_LEVEL
Many thanks to all who reply
Dan