问题标签 [bindvalue]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
180 浏览

c++ - QT5/QSql bindValue 查询不起作用

我有一个使用 QSql 的查询

我使用订单值作为“DESC”,但它不能正常工作。但是,当我这样做时

它工作正常,我不知道为什么。这些值的类型相同( QString 和 int )。有什么建议么 ?

谢谢。

0 投票
1 回答
2881 浏览

php - Yii2 bindValue 在 LIKE 条件下

鉴于此查询,我如何在 LIKE 条件下使用 bindValue(:name, $name) 进行通配符搜索:

0 投票
1 回答
50 浏览

php - PHP 绑定值

我在绑定多个值时遇到问题。我已经尝试了一个值,它工作正常。有什么我想念的吗?

当我运行查询时,它给了我一个错误:警告:PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in C:\xampp\htdocs\Media\admin第 35 行的 \dashboard\classes\DB.php

0 投票
0 回答
374 浏览

php - PHP: PDO dynamic bindValue

I'm probably missing something simple here. I'm trying to dynamically populate bindValue statements. From what I can tell they work up until they reach a set of code that pulls in key and value pairs from a dynamically generated set of facets.

The array for the bind values ($pdokeys) looks like this just before executing:

The code for bindValues looks like this:

Based on the writing out the pdo bindvalue just before binding the values, it appears the bindValue fails when I try to bind the first facet :icapabilities1.

The output looks like this.

The facets are added to the $pdokeys array that I'm using to create the PDO bindArray in the following fashion:

If I have other array elements in $pdokeys in front of the icapabilities1, those bindValues appear to work, (I get all the echo statements up till the bindVal icapabilities1), so I'm assuming it has to be something with the way I'm creating or passing the capabilities bindValue statement.

0 投票
1 回答
451 浏览

php - 使用 PDO bindValue 将数组插入数据库

我需要在我的一个表字段中插入一个数组。所以我定义了一个函数来将输入转换为数组,如下所示:

然后我想用 PDO 将它插入到数据库中,但是在绑定值时我有一个错误说:

数组到字符串转换错误

这是我的代码:

任何想法如何解决我的问题?谢谢!

0 投票
3 回答
3340 浏览

php - 在 PHP PDO 中使用 bindValue() 时“:”是什么意思?

:在下面的示例中之前是什么意思id?有必要吗?

我可以说:id是变量吗?

如果PDO::PARAM_INT没有必要,我为什么需要使用它?

0 投票
0 回答
448 浏览

php - 在 PHP 中打印 SQLite 查询

我正在使用带有 SQLite3 的 PHP 来管理一些网站会话,但我遇到了不返回结果的查询的问题。问题是我想在execute命令之前打印查询,但我找不到这样做的方法。

更具体地说,我使用 bindValue 来生成查询,然后我需要打印生成的语句或 sqlite 执行的查询。我的代码是这样的:

编辑: 我想打印到类似的日志:

谢谢你的帮助。

0 投票
1 回答
53 浏览

mysql - PDO BindValue 不起作用,但适用于直接粘贴

所以我有一些代码

如果我用原始输入替换:clausein ,那么它工作正常。一旦我尝试使用 :clause 或使用 a 绑定它,它就会失败。我不知道该怎么办:(谢谢你的帮助!$sql'2016-09-09' AND '2016-09-09'?

0 投票
1 回答
603 浏览

php - PDO + MsSQL + freetds = INSERT 查询中的错误字符

我在我的内部项目中的 SELECT 查询期间注意到一个关于 utf8 字符 (šđčćž) 的问题。在我解决了 freetds.conf 中关于字符集和版本的 freetds 定义的问题之后,我在运行 SELECT 查询时开始接收正确的字符。

但!现在,当我尝试使用其中一些字符(šđčćž)搜索字段时,我遇到了有关 INSERT/UPDATE 查询和 SELECT 查询的问题,而这仅适用于 PDO bindValue 方法。

例如,这是我的代码:

当我尝试使用以下代码插入值时,数据库中的插入值是正确的:

但是,在使用 bindValue 方法(我必须使用,因为我使用 Symfony2)之后,问题发生了:

Bellow,你可以找到我当前的 freetds 配置:

数据库字符集联盟是克罗地亚语_CI_AS。不幸的是,我无法更改它,因为它是旧数据库,旨在与旧应用程序一起使用,并且我正在为该应用程序进行 Web 演示。

0 投票
0 回答
21 浏览

php - PDO bindValue() 在 value 周围添加撇号

我想使用 PDO 准备好的语句创建一个表。问题是 bindValue''在绑定值周围添加。我不明白为什么会这样。我怎样才能避免这种情况,以便我的表名设置为users而不是'users'?谢谢。

代码:

这是 phpmyadmin 中的结果:

在此处输入图像描述