问题标签 [prepare]

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 投票
1 回答
477 浏览

php - 用于将数组插入数据库问题的 PDO 准备语句

我正在使用 PDO 创建用户注册系统,并尝试将用户表单数据插入数据库表中。很简单,但是错误的值被输入到数据库中。输入到数据库中的值是:username、:password、:email_address、:city 等,而不是从我的表单传递给函数的值。关于我做错了什么的任何想法?我尝试使用 bindParam 和 bindValue 但结果相似,并且根据其他帖子我得出结论,使用数组是最好的方法。帮助!

0 投票
1 回答
108 浏览

php - PHP SELECT * FROM 无法正常工作

我在使用以下代码时遇到问题:

每当我尝试注册一个新帐户时,我都会被发送到一个由主机预设的错误页面。所以我得到一个404错误。我很确定问题出在

我在那段代码中做错了什么?

0 投票
3 回答
124 浏览

php - 致命错误:调用成员函数 prepare()

我一直在看这段代码很长时间了,我无法真正理解它想要从我这里得到什么。无论我尝试什么,我都会收到相同的错误消息,而且我查看了其他线程无济于事。错误是Fatal error: Call to a member function prepare() on a non-object in C:\wamp\www\new_serverside\sprint1.php 在第 63 行。我的代码是:

0 投票
1 回答
66 浏览

php - 准备好的查询未返回尝试查找用户的预期结果

当我在 phpMyAdmin 中执行此操作时,我有一个结果:

但是在我的 PHP 代码中,脚本找不到我的用户。我做错了$stmt->bind_param("s", $unsafe_user);什么吗?

我也试过$stmt->bind_param("s", "user01");没有运气。

0 投票
1 回答
1166 浏览

php - Is it possible to set innodb_stats_on_metadata in PHP PDO prepare statement?

I transfer part of MySQL database from one server to another using XML. In this XML I have all DB related information I need (data & metadata). Everything works fine except one thing – obtaining foreign key constraints from information_schema.

The problem lies in performance. Getting approximately 100 constraints takes up about 7 minutes of PHP script loading! However, if one runs command

with constraint query (i.e. in PHPMyAdmin) like this

everything takes up about 5 seconds and it's done. Now, this is a huge timesaver and it would be really great if I could use this in following fashion:

The problem is that exec command is just ignored here and process time is still very long. If I put that command into prepare (before SELECT and separated by semicolon) everything just ends with an error.

So my question is: How can I set mysqli DB parameter innodb_stats_on_metadata inside PHP PDO structure which uses transactions and prepare statements?

0 投票
1 回答
91 浏览

mysqli - mysqli准备更新查询失败

以下代码在准备时失败:

我明白了: 警告:mysqli::prepare() [mysqli.prepare]: Couldn't fetch mysqli ...我在上面的代码中做错了什么?我检查了语法文档,但如果我尝试将查询作为 sql 传递,我会收到语法错误。mysqli语法错误有没有好的调试工具?

0 投票
1 回答
1541 浏览

mysql - How to write "create user ?" with MySQL prepared statement

I tried:

and I get error

I also tried multiple variants how to define variables, but still without any luck.

and even

Quite similar question was already asked more than 2 years ago, but there still is no useful answer :( Create User with MySQLi Prepared Statement

0 投票
3 回答
80 浏览

php - 调用成员函数 execute() on

第 27 行遇到问题,不太清楚为什么,因为我对 PHP/MySQL 很陌生。想知道是否有人可以告诉我为什么我会收到错误;

“致命错误:在第 27 行调用 C:\xampp\htdocs\testscripts\usercreate.php 中非对象的成员函数 execute()”

在以下代码中:

0 投票
1 回答
81 浏览

php - ipn --- pdo 错误处理

我正在使用 ipn 沙箱来检查一些进程:

所以这是我的 ipn 脚本的一部分,但它没有得到处理,我的表中没有任何内容。我无法回显或打印错误,导致其 ipn..但是:我可以在此日志文件中写入错误:

但是在那里写什么,有人可以帮助我吗?问候

0 投票
2 回答
1608 浏览

java - prepare() 方法被调用了两次,当结果类型是 Struts2 中的重定向动作时

我有以下动作类:

在执行除了与insert()方法关联的插入和更新之外的所有操作(它们都与insert()映射到<s:submit>动作的关联)时,该prepare()方法只执行一次。

在执行插入或更新时,prepare()可以看到该方法被调用了两次。为什么会这样?

type="redirectAction"在in的情况下@Result(),该prepare()方法被执行两次。当of设置为时,有没有办法防止该prepare()方法被执行两次?type@ResultredirectAction