php mysql和pdo [英] php mysql and pdo

查看:78
本文介绍了php mysql和pdo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正忙着尝试从古老的PHP转移到可爱的OO php,但我遇到了障碍。


以下两个脚本连接,请求插入数据,并且用于存储它,但它没有,我没有错误。


为了我自己的理智你可以提供建议吗?


谢谢



连接脚本

Hi all,

Im busy trying to move from archaic php to lovely OO php, but i have hit a hurdle.

The following two scripts connect, request data to be inserted, and is meant to store it, but it doesnt and i get no errors.

for my own sanity can you advise?

Thank you


connection script

展开 | 选择 | Wrap | < span class =codeLinkonclick =LineNumbers(this);>行号

推荐答案

嘿。


您是否打开了错误消息?

在表单脚本的第45行和第48行中,您使用
Hey.

Do you have error messages turned on?

On lines #45 and #48 in your form script you use the


q 变量作为对象,但 PDOStatement ::执行方法只返回 对或错。


此外,在第38行,您在实际验证记录已成功创建之前过早地打印成功消息。


I我必须承认,我对PDO不是很有经验,所以我可能会忽略一些东西。


O,和PS
q variable as an object, but the PDOStatement::execute method only returns TRUE or FALSE.

Also, on line #38 you prematurely print a success message, before you actually verify that the record has been created successfully.

I must admit, I am not very experienced with PDO, so there may be something I am overlooking.

O, and P.S.
展开 | 选择 | Wrap | 行号





感谢您的回复。


我已将其转移到我的直播中托管和同样的事情发生。


我在所有领域都输入了一些东西但是当我cl ick将所有字段提交为空。
Hi,

Thanks for the response.

Ive transferred it to my live hosting and the same happens.

I enter something into all of the fields but when i click submit all of the fields empty.


这篇关于php mysql和pdo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆