gpt4 book ai didi

php - 准备语句无法插入四个变量中的两个

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

enter image description here我向表中添加了两个新字段。 SQL insert into 继续对两个旧字段起作用,但无法为两个新字段插入任何数据。这两个新字段是 $authorflag$artistflag。这两个字段应该是 bool 变量。

我尝试过将这些变量从整数更改为字符串,更改它们的位置,甚至重新创建表,以便所有四个字段都是新的。尽管进行了这些调整,实际上只有两个旧变量被插入到表中。新变量显示为 null

$authorflag='NNNNNNNN';
$artistflag=0;
login();
$stmt=$conn->prepare('INSERT INTO tblAuthorList (AuthorLast,AuthorFirst,AuthorFlag,ArtistFlag) Values(?,?,?,?)');
$stmt->bind_param('sssi', $lastname,$firstname,$authorflag,$artistflag);
$stmt->execute();

最佳答案

问题已解决。代码是正确的。问题是意外地交叉链接了两种形式。我的数据库有两个版本,一种用于生产,一种用于测试。我已将两个表合并为一个(在两个版本上),并相应地修改关联的表单。

感谢您提供反馈。了解别人的想法非常有用。新年快乐。

$authorflag=1;
$artistflag=0;
login();
$stmt=$conn->prepare('INSERT INTO tblAuthorList (AuthorLast,AuthorFirst,AuthorFlag,ArtistFlag) Values(?,?,?,?)');
$stmt->bind_param('ssii', $lastname,$firstname,$authorflag,$artistflag);
$stmt->execute();

关于php - 准备语句无法插入四个变量中的两个,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41404411/

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