too long

I'm tyring to make a login page where user's login time will be inserted in the table if an entry is not present in the "loginTime" row of "emp" table otherwise no updation. The idea is to enter only the first login time.

 $query="SELECT loginTime FROM emp WHERE month='Jun' ";
 $result=mysql_query($query,$connection);

 if(empty($result)   //checking if row empty
 {
  //updation done

  $query_time="UPDATE  SET loginTime='$time' WHERE month='$month' "; /*$time and $month                                                
  mysql_query($query_time,$con);                                       already contain 
                                                                       value,I've not                                  
                                                                       shown
 }

I've also tries $result==NULL and isset() to check if row is empty or not. None of them work. Please help. */

You can use mysql-num-rows for checking the records exist or not

 $query="SELECT loginTime FROM emp WHERE month='Jun' ";
 $result=mysql_query($query,$connection);
 $num_rows = mysql_num_rows($result);

if($num_rows >0)  
{
//updation done
$query_time="UPDATE  SET loginTime='$time' WHERE month='$month' ";                                                 
mysql_query($query_time,$con);                    
  }