PDO参数化查询

编程入门 行业动态 更新时间:2024-10-24 08:28:27
本文介绍了PDO参数化查询-重用命名的占位符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

从本质上讲,我有一个必须在SQL查询中多次调用的值.因此,可以在语句中重用相同的命名占位符,例如 SELECT :Param FROM Table WHERE Column = :Param,然后只需bindValue(:Param"),并为两个:Params提供值?

In essence, I have a value that I have to call a couple times in my SQL query. Thus, is it possible to reuse the same named placeholder in the statement e.g. SELECT :Param FROM Table WHERE Column = :Param, then simply bindValue(":Param"), and have the value be there for both :Params?

推荐答案

PDO :: prepare 指出您不能在准备好的语句中两次使用相同名称的命名参数标记",所以我想那是不可以的.

PDO::prepare states that "you cannot use a named parameter marker of the same name twice in a prepared statement", so I guess that's a no then.

更多推荐

PDO参数化查询

本文发布于:2023-10-23 06:03:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1520007.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:参数   PDO

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!