SQL is not deleting all the data in the query
SQL TABLE
BD int,
un varchar(255),
branch varchar(255),
dates varchar(255),
morning_in varchar(5) default '{$time[0]->end}',
morning_out varchar(5) default '{$time[0]->end}',
afternoon_in varchar(5) default '{$time[1]->end}',
afternoon_out varchar(5) default '{$time[1]->end}'
BD un branch dates morning_in morning_out afternoon_in afternoon_out104 Jason HQ 2015-12-05 06:55 12:00 16:05 18:00 14 jack HQ 2015-12-05 07:00 12:00 16:08 18:00 14 jack HQ 2015-12-05 07:00 12:00 16:08 18:00
I need it to delete between 05:00
to 07:10
$mssqldb->get_results("DELETE from tempUSERlog where morning_in BETWEEN '05:00' AND '07:10' AND afternoon_in BETWEEN '15:30' AND '16:10'");
I need it to delete between 07:00
to 12:10
$mssqldb->get_results("DELETE from tempUSERlog
where morning_in = '07:00' AND
morning_out ='12:00' AND afternoon_in='16:00'
and afternoon_out='18:00'");
Im using this piece of class link
PDO have issues on my Windows server.
What am I doing wrong?
i think you should use 'or' operator instead of 'and' operator.
I think you mean this:
DELETE from tempUSERlog
WHERE morning_in >= '07:00'
AND morning_out <= '12:00'
AND afternoon_in >= '16:00'
AND afternoon_out <= '18:00'
Probably you need to include your dates
in your WHERE
clause
You should use exec function in deleting data like the example in the link below. http://www.w3schools.com/php/php_mysql_delete.asp
The function get_results should be used to get data not to delete data
Heres a link for sample crud http://www.mustbebuilt.co.uk/php/insert-update-and-delete-with-pdo/