[英]SQL query not deleting data
SQL is not deleting all the data in the query SQL不会删除查询中的所有数据
SQL TABLE SQL表
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_out 104 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
我需要在
05:00
至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
我需要在
07:00
至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. PDO在我的Windows服务器上有问题。
What am I doing wrong? 我究竟做错了什么?
我认为您应该使用“或”运算符而不是“与”运算符。
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 可能需要在
WHERE
子句中包含dates
You should use exec function in deleting data like the example in the link below. 您应该使用exec函数删除数据,例如下面的链接中的示例。 http://www.w3schools.com/php/php_mysql_delete.asp
http://www.w3schools.com/php/php_mysql_delete.asp
The function get_results should be used to get data not to delete data 函数get_results应该用于获取数据而不是删除数据
Heres a link for sample crud http://www.mustbebuilt.co.uk/php/insert-update-and-delete-with-pdo/ 这是示例Crud的链接http://www.mustbebuilt.co.uk/php/insert-update-and-delete-with-pdo/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.