手机版
热门标签
站点地图
我要投稿
广告合作
联系我们
搜 索
广告位招租
广告位招租
切换导航
首页
人工智能
编程教程
编程导航
编程百科
编程问答
编程博文
编程实例
硬件设备
网络运营
软件教程
移动数码
办公软件
操作系统
网络运维
技术频道
▸ 编程语言
▸ 前端开发
▸ 移动开发
▸ 开发工具
▸ 程序设计
▸ 行业应用
▸ CMS系统
▸ 服务器
▸ 数据库
公众号推荐
微信公众号搜
"智元新知"
关注
微信扫一扫可直接关注哦!
prepared-statement
prepared-statement专题提供prepared-statement的最新资讯内容,帮你更好的了解prepared-statement。
bind_result成一个数组PHP mysqli准备语句
想知道如何将 PHP准备语句的结果绑定到数组中,然后我可以如何调用它们.例如这个查询 $q = $DBH->prepare("SELECT * FROM users WHERE username = ?"); $q->bind_param("s", $user); $q->execute(); 这将返回结果的用户名,电子邮件和id.想知道我是否可以将其绑定到数组中,然后将其存储在变量中,以便我可以
作者:佚名 时间:2020-07-03
php – 哪些令牌可以在PDO预处理语句中参数化?
我正在使用 PHP / PDO中的预处理语句.基本查询工作正常,将值传递给WHERE子句: $stmt = $db->prepare( 'SELECT title FROM episode WHERE id=:id' ); $stmt->bindParam( ':id', $id, PDO::PARAM_INT ); $id = 5; $stmt->execute(); 但是我有一种情况需要为字段
作者:佚名 时间:2020-07-04
php – mySQLi预处理语句无法get_result()
我对mySQLi感到很困惑.虽然我多年来一直在使用过程式 mysql调用,但我想习惯为它提供的db security / mySQL注入保护制作预备语句.我正在尝试编写一个简单的select语句(是的,我知道为此提供性能增强的程序调用).在运行时,我得到了所有的回声,直到我点击$result = $stmt-> get_result();零件.对我来说这一切看起来都相当简单,但是在mySQLi上阅
作者:佚名 时间:2020-07-05
php – 如何使用预准备语句一次在mysql数据库中插入多行?
我试图在 this question中使用staticsan的答案来准备陈述. 让我们举个例子: $stmt = $mysqli->prepare("INSERT INTO something (userid, time, title) VALUES (?, ?, ?)"); $stmt->bind_param('iis', $userid, time(), $title); $stmt->exe
作者:佚名 时间:2020-07-05
php – 如果我使用MySQLi预处理语句,我是否需要转义我的变量?
如果我使用 MySQLi准备好的语句,如下所示: $stmt = $con1->prepare("UPDATE Login SET Session='LoggedOut' where Session=?"); $stmt->bind_param('s',$Session); $stmt->execute(); $stmt->close(); 我是否还需要使用mysqli_real_escape_s
作者:佚名 时间:2020-07-06
PHPUnit – 如何模拟PDO预处理语句
我正在尝试使用 PHPUnit对mapper类进行单元测试. 我可以轻松地模拟将在mapper类中注入的PDO实例,但我无法弄清楚如何模拟PreparedStatement类,因为它是由PDO类生成的. 在我的情况下,我已经扩展了PDO类,所以我有这个: public function __construct($dsn, $user, $pass, $driverOptions) { /
作者:佚名 时间:2020-07-06
php – 2个准备好的语句,2个存储过程,1个mysqli连接
问题 如何使用预准备语句(或另一种对SQL注入同样安全的查询方法)在同一mysqli连接中调用两个MySQL存储过程,而不会出现以下错误: Warning: Packets out of order. Expected 1 received 61. Packet size=7 in /... Warning: mysqli::prepare(): MySQL server has gone awa
作者:佚名 时间:2020-07-06
php – 使用预准备语句时“不允许属性访问”警告
我正在尝试使用AES_ENCRYPT()对我的密码进行编码来登录系统.但是在尝试实现这些代码时,我从xdebug得到了一些警告: ... $key = 'd0gis=SUPER-cute'; $sql = "SELECT * FROM `users2` WHERE username = ? AND pwd = AES_ENCRYPT(?, ?)"; $stmt = $conn->stmt_init
作者:佚名 时间:2020-07-06
php – 预处理语句中的递归
我一直在使用PDO并准备我的所有陈述主要是出于安全原因.但是,我的代码中有一部分使用不同的参数执行相同的语句多次,我认为这将是准备好的语句真正发挥作用的地方.但他们实际上打破了代码…… 代码的基本逻辑是这样的. function someFunction($something) { global $pdo; $array = array(); static $handle = nu
作者:佚名 时间:2020-07-07
php – 我应该何时使用预准备语句?
最初我使用 mysql_connect和 mysql_query来做事情.然后我学会了SQL注入,所以我试图学习如何使用预处理语句.我理解PDO类的准备和执行函数如何有助于防止SQL注入. 但是,只有在用户输入存储到数据库中时才需要准备语句.还是可以继续使用mysql_num_rows,因为我真的没有冒这个功能被黑客入侵的风险吗?或者使用预准备语句来执行此操作更安全吗?我应该使用预准备语句来处理涉
作者:佚名 时间:2020-07-07
PDO ::查询与PDOStatement :: execute(PHP和MySQL)
我已经扩展了PDO类来创建一个简单的DB类,并且当前对所有运行到数据库的查询使用prepare执行,甚至是那些没有参数的查询(例如SELECT * FROM table). 问题是:对于没有参数的简单查询而不是prepare / execute,实际使用PDO :: query是否有性能优势? 是的,因为当您调用PDO :: prepare时,服务器必须为该查询创建查询计划和元信息,然后在使用PD
作者:佚名 时间:2020-07-07
总是用PHP准备SQL语句有什么问题吗?
总是用 PHP准备SQL语句而不是直接执行它们有什么问题吗? 不确定数据库系统是否重要,但它是System i上的DB2. 如果它们是真正准备好的语句而不仅仅是在驱动程序中模拟,那么您可能会受到轻微的性能影响.这是因为您必须对数据库进行两次调用,而不是只调用一次.
作者:佚名 时间:2020-07-09
php – 这是什么意思?
我在google搜索时在一些代码示例中找到了这个: $sql = 'INSERT INTO users (username,passwordHash) VALUES (?,?)'; 这对我来说是新的,但我猜它是一种替代方法,等同于 $sql = "INSERT INTO users (username,passwordHash) VALUES ($username,$passwordHash)";
作者:佚名 时间:2020-07-12
php – 不应该准备好更快的语句吗?
$s = explode (" ", microtime()); $s = $s[0]+$s[1]; $con = mysqli_connect ('localhost', 'test', 'pass', 'db') or die('Err'); for ($i=0; $i<1000; $i++) { $stmt = $con -> prepare( " SELECT MAX(id) AS
作者:佚名 时间:2020-07-13
Php准备声明关闭仿真
使用带有pdo的预准备语句时,关闭仿真是否有任何副作用?我正在使用select *并将结果限制为需要作为int处理而不是字符串.我可以做两件事之一. $conn->setAttribute( PDO::ATTR_EMULATE_PREPARES, false ); 或者使用param类型显式绑定这些变量: $stm = $pdo->prepare('SELECT * FROM table LIMI
作者:佚名 时间:2020-07-14
动态准备陈述是否不好? (用php mysqli)
我喜欢Dynamic SQL的灵活性,我喜欢Prepared Statements的安全性改进性能.所以我真正想要的是动态准备语句,这很麻烦,因为bind_param和bind_result接受“固定”数量的参数.所以我使用了一个eval()语句来解决这个问题.但我觉得这是一个坏主意.这是我的意思的示例代码 // array of WHERE conditions $param = array('
作者:佚名 时间:2020-07-15
php – mysqli预处理语句和mysqli_real_escape_string
我目前正在使用 mysqli php扩展. 传统上我使用mysqli_real_escape_string来逃避用户输入.但是,我正在考虑更改代码(希望尽可能少的步骤)来使用预准备语句. 我想明确这一点 – 假设我使用预处理语句来绑定我的所有变量,我可以确信sql注入是不可能的吗? (并完全免除mysqli_real_escape_string?) 谢谢 如果正确绑定所有变量,可以大大降低SQL注
作者:佚名 时间:2020-07-15
php – MySQL PDO准备比查询更快?这就是这个简单的测试所显示的
这是一个简单的测试,我试图快速了解使用 MySQL PDO预处理语句与使用直接查询所支付的性能损失.人员表中有2801行. MySQL版本5.5.28和 PHP版本5.3.15.香草装置,无论默认参数如何.测试在8GB的iMac上运行. $pdo = new PDO('mysql:host=localhost;dbname=cwadb_local', 'root', ""); $start = m
作者:佚名 时间:2020-07-18
PHP:使用预准备语句并防止SQL注入vs转义
我确实理解准备好的语句是寻求防止SQL注入的最终方法.但是,它们以有限的方式提供覆盖;例如,在我让用户决定操作顺序如何(即ASC或DESC等等)的情况下,我没有用准备好的语句覆盖那里. 我知道我可以将用户输入映射到预定义的白名单.但是,这只有在事先可以创建或猜测白名单时才有可能. 例如,在我上面提到的情况(ASC或DESC)中,可以根据接受的值列表轻松映射和验证.但是,是否存在无法针对白名单验证S
作者:佚名 时间:2020-07-19
php – 在longtext字段上准备好的mysqli select语句将返回空
我有一个运行良好的数据库查询功能 – 除了我遇到了 mysqli预处理语句和longtext字段显然已知的问题.即使通过phpMyAdmin运行查询工作正常,longtext字段总是空的,会发生什么.根据 http://www.workinginboxershorts.com/php-mysqli-returns-empty-variables-from-longtext-column,将数据类型
作者:佚名 时间:2020-07-20
上一页
9
10
11
12
13
14
15
16
17
下一页
小编推荐
苹果市值2025年有望达4万亿美元
• 联想拯救者新一代Y700平板通过IMDA认证
• 最新AI生图模型Flux1.1刷屏!添加单反相
• 联发科天玑 9400 频率敲定,3.626GHz 最
• 苹果新品发布会来了!5款产品面临停产
• 佳能R5C Mark II配置曝光:双系统设计,
• AI应用的东风,奥特曼不想错过
• 为新品让路!苹果定制版Mac发货延期
热门标签
更多
python
JavaScript
java
HTML
PHP
reactjs
C#
Android
CSS
Node.js
sql
r
python-3.x
MysqL
jQuery
c++
pandas
Flutter
angular
IOS
django
linux
swift
typescript
路由器
JSON
路由器设置
无线路由器
h3c
华三
华三路由器设置
华三路由器
电脑软件教程
arrays
docker
软件图文教程
C
vue.js
laravel
spring-boot