您好,朋友们,我需要更新我的数据库中的一些表行,但我没有得到任何东西,在我的php函数没有错误,没有更新,请帮助我解决这个问题。
我的表名为user_account,它有以下列,id,user_id,这是另一个表的FK,account,address
这个类支持所有函数。Dbhandler.php
public function create_account($user_id, $account, $address) {
$stmt = $this->conn->prepare("UPDATE user_account set account= ?, address= ? where user_id = ? ");
$stmt->bind_param("iss", $user_id, $account, $address);
$stmt->execute();
}
**This file calls create_account function when i submit**
<?php
include './DbHandler.php';
$db = new DbHandler();
$response = array();
if ( isset($_POST['user_id']) && (isset($_POST['account']) && isset($_POST['address']) )!= '') {
$user_id = $_POST['user_id'];
$account = $_POST['account'];
$address = $_POST['address'];
$res = $db->createProfile($user_id, $account, $address);
}
?>发布于 2016-09-26 00:37:45
您的sql语句是update,但您应该使用insert。我假设该行还不存在于表中,因为函数名为createProfile/create_account?
Insert into user_account values ()https://stackoverflow.com/questions/39689048
复制相似问题