www.webdeveloper.com
Results 1 to 4 of 4

Thread: Issue in saving 0000-00-00 00:00:00 or IsNull values

  1. #1
    Join Date
    Oct 2011
    Posts
    350

    Issue in saving 0000-00-00 00:00:00 or IsNull values

    Hi,
    I notice that in my query:

    Code:
    $result = mysql_query("INSERT INTO payroll.reg_att(EMP_NO, LOGIN, LOGOUT, TotalHours) 
    SELECT DISTINCT a.EMP_NO, a.LOGIN, a.LOGOUT, TIMEDIFF(a.LOGOUT, a.LOGIN)  FROM payroll.date_upload d, attendance.employee_attendance a JOIN hris.employment em ON (a.EMP_NO = em.EMP_NO AND em.STATUS = 'Reg Operatives') WHERE DATE(LOGOUT) BETWEEN '$FROM_DATE' AND '$TO_DATE' AND d.EMP_STATUS = 'Reg Operatives' OR ISNULL(LOGIN) OR ISNULL(LOGOUT)")  
     or die(mysql_error());
    it did not insert data where LOGOUT is 0000-00-00 00:00:00


    Thank you

  2. #2
    Join Date
    Feb 2012
    Location
    youTUBE
    Posts
    234
    Hi, to begin, can you represent your thought out logical precedences for the "ands" and "ors" in the Query using parentheses?

  3. #3
    Join Date
    Oct 2011
    Posts
    350
    Quote Originally Posted by WyCnet View Post
    Hi, to begin, can you represent your thought out logical precedences for the "ands" and "ors" in the Query using parentheses?
    What?

    Use parenthesis in OR and And?

    Thank you

  4. #4
    Join Date
    Oct 2011
    Posts
    350
    Now, I realize why the LOGOUT = 0000-00-00 00:00:00 was not save because of this condition:

    Code:
    $FROM_DATE = 2012-03-01
    $TO_DATE = 2012-03-15
    WHERE DATE(LOGOUT) BETWEEN '$FROM_DATE' AND '$TO_DATE'
    now how can I get even the DATE(LOGOUT) = 0000-00-00

    Thank you so much

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles