i have a table like this
+-----------------------------------------------------------------+
| seeker |
+----+-------+----------+---------------+-------------------------+
| id | name | password | register_date | login_date | limit_date |
+----+-------+----------+---------------+------------+------------+
| 01 | ali | **** | 2012-02-08 | 2012-02-09 | 2012-03-09 |
| 02 | hamza | **** | 2012-04-10 | 0000-00-00 | 0000-00-00 |
| 03 | sam | **** | 2012-04-15 | 0000-00-00 | 0000-00-00 |
+----+-------+----------+---------------+------------+------------+
register_date = when user ger registered
login-date= when user attempt to login
limit date= login-date + 1 month
now i have to apply two different delete query one for user who register and login "ali" one for user who only register but didnot attempt to login "hamza, sam" and have login-date='0000-00-00'
i am using if-statment
like this
$qry="select * from seeker where login_date='0000-00-00'";
$rs= mysql_query($qry, $con);
$res=mysql_fetch_array($rs);
if($res==0)
{
//query to delete user who has login date
$q= "delete from seeker where current_date = limit_date'";
if($rq=mysql_query($q, $con));
echo "$q";
}
else if($res!=0)
{
//query to delete user who didnot login and has login-date='0000-00-00'
$qry1="delete from seeker where '$days' >= 30";
$rs1= mysql_query($qry1, $con);
echo $qry1;
}
i am very confused and making some mistake in if-statment
i guess.
when i run this code it executes only else if
. it should also execute first if
because both conditions occurs according to my database