Validation from sqlsrv rows

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Harties
    New Member
    • Aug 2015
    • 1

    Validation from sqlsrv rows

    Good day,
    I am trying to validate data from a sqlserver database.
    My approach is:
    fields that I am checking are bit fields. Field names are the days of the week. Set to True or False in another program.
    I basically want to check for the current day of the week and determine I the current day of the week matches the day and row from database and is true or false.
    In my current code, below, the value of $Allowtoday changes back to 'no' after it was set true, correctly.
    Code:
    $Allowtoday = 'no';
    $timestamp = time();
    $whatdayisit = date('D', $timestamp);
    while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
    
    switch ($whatdayisit) {
    
        case "Mon";
            if($row['Monday'] === true){
                $cellno = $row['AuthorisedCellNo'];
    			$Allowtoday = 'yes';
                break;
            }
            else
            {
                //echo '<dd><strong>Person not Authorised to Enter on a Monday! </strong></dt> ';
               
            }
        case "Tue";
          etc....		
    
    if($Allowtoday = 'no') {
    	echo "blah, blah
    	exit;
    rgs
    Last edited by Rabbit; Aug 31 '15, 04:48 AM. Reason: Fixed code tags
Working...