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

MySQL SELECT查询在PHP数组中

I have a PHP array and what I am trying to do is use that in my MySQL query to select only the ones that are in the array.

I have this:

SELECT * FROM table IN ('.implode(',', $array).')

I guess what needs to happen is I need quotes around each array item for this to work. Right now it just has one, two, three, four where it should be "one", "two", "three", "four"

How could I do that? Or is there another way to do what I am looking for?

Thanks!

This would do it,

"'" . implode("','", $array) . "'"

近期文章

  • 如何创建自己的'Smarty'标签
  • 如何获得数组成员的总和?
  • 备用php重定向方法,与前面的输出一起使用
  • 在php之后只显示三个字符
  • 在PHP中解析JSON
  • 怀疑PHP中的Strtok
  • 为什么不能将imagejpeg保存到文件夹中?
  • HTMLENTITIES不适用于西里尔字母
  • PHP哪个版本支持simplexml cdata
  • Twilio REST api顺序调用可能吗?
  • 在PHP中自动输出MySQL行
  • 如何使用PHP从Internet保存文件?
  • 在java android app和PHP脚本之间交换数据最安全的方法? [重复]
  • 使用PHP从HTTP帖子更改为HTTPS帖子
  • 显示包含超过7000个地点标记的Google地图的最佳方式是什么?
  • php图像采集卡
  • 可以使用一段代码来阻止旧浏览器访问网站阻止搜索引擎蜘蛛吗?
  • UPS API使用cURL和PHP ...格式良好的XML问题
  • Facebook应用程序:任何人都可以添加到他们的页面[重复]
  • PHP图像无法做任何事情

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

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

友情链接:代码精华