PHP PDO MYSQL问题 [英] PHP PDO MYSQL problem

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

问题描述

大家好,


在向这个脚本发布GET时,我会将这些值与图像一起上传,然后上传为mysql blob。


在向网址添加其他变量时,我收到错误消息。我可以将获取变量反映到该页面,因此我知道它们已被捕获


我们将非常感谢您的帮助


该URL为: http://........./index.php?id = 1& p = 1


错误是:SQLSTATE [23000]:完整性约束违规: 1048列''user_id''不能为空


且代码为

Hi All,

On posting a GET to this script, I take those values, along with the image, and upload as mysql blob.

On adding an additional variable to the url i get an error message. I can echo out the get variables to that page so i know they have been captured

Your help would be appreciated

The URL is: http://........./index.php?id=1&p=1

The error is: SQLSTATE[23000]: Integrity constraint violation: 1048 Column ''user_id'' cannot be null

and the code is

展开 | 选择 | 换行 | 行号

推荐答案

数据库中 user_id 的数据类型是什么?
what data type is user_id in your DB?


数据类型是INT,th和所有者一样。


奇怪的是如果它完全删除了user_id它一切正常
The data type is an INT, the same as owner.

The wierd thing is if it totally remove the user_id it all works fine


如何传递 user_id 使用PDO :: PARAM_INT?


PS。如果语句只执行一次,
how about passing user_id with PDO::PARAM_INT ?

PS. if the statement is executed only once,


这篇关于PHP PDO MYSQL问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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