我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

PHP之间的Mysql数组

I have an array of dates.. example:

$dates = array('2018-06-01', '2018-06-02', '2018-06-03');

How to find it's exists in between dates without foreach?

Example:

SELECT * FROM table WHERE $dates BETWEEN from AND to;

I solved this question converting the datetime field do unix timestamp in query:

SELECT * FROM table WHERE UNIX_TIMESTAMP(from) IN ($dates) OR UNIX_TIMESTAMP(to) IN ($dates)

Note: array of dates are converted to unix format and implode ",".

近期文章

  • 好vtiger。 API创建PurchaseOrder
  • 全球分页重写网址
  • 在Woocommerce中使用自定义字段变量作为短代码参数值
  • 将$ 516.91兑换成51691
  • Nginx不处理php文件并保存(php7.2-fpm)?
  • 从深度的递归树建设者
  • 如何在Wordpress中的URL端添加“/”
  • 覆盖供应商自动加载编写器
  • 统一到PHP到XML /升级问题
  • 使用Events Calendar Pro动态填充GF下拉列表
  • 在制作PHPExcel Reader时不能使用标量作为数组
  • 试图将变量传递给URL PHP
  • 为页面浏览刮刮Facebook页面
  • 如何将当前请求传递到Guzzle
  • 为什么我对使用Guzzle的API的帖子请求不起作用?
  • 用于通过URL传递变量的php双向加密
  • 你能帮我修复我的代码中的错误[重复]
  • 使用Bootstrap navwalker的Wordpress菜单断点
  • mysql连接1表的位置
  • 如何使用mysqli将图像插入数据库?

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华