gpt4 book ai didi

php - 使用PHP设置mysql参数

转载 作者:行者123 更新时间:2023-11-29 23:19:27 25 4
gpt4 key购买 nike

这是我的代码:

public function SelectSingleAccount($Id)
{
$Config = new Config();
$mysqli = $Config->OpenConnection();
$result = mysqli_query($mysqli, "CALL SelectSingleAccount", $accountId) or die("Query fail: ". mysqli_error());

$BusinessObject = new DL_Account();
$ArrayResult = $BusinessObject->CreateObjectArray($result);
return $ArrayResult;
}

在 phpmyadmin 中,我有一个名为 id 的参数。如何使用 $Id 值在代码中设置此参数?

最佳答案

存储过程参数位于查询字符串内:

$result = mysqli_query($mysqli, "CALL SelectSingleAccount($Id)");

确保 $Id 已正确清理

关于php - 使用PHP设置mysql参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27451438/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com