douzao1119 2016-12-31 00:37
浏览 38
已采纳

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

enter image description hereI added two new fields to a table. The SQL insert into continues to work for the two old fields, but fails to insert any data for the two new fields. The two new fields are $authorflag and $artistflag. These two fields are supposed to be boolean variables.

I have experimented by changing these variables from integer to string, changing their position, and even re-creating the table so that all four fields are new. Despite these tweaks, only the two old variables are actually inserted into the table. The new variables show-up as 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();
  • 写回答

1条回答 默认 最新

  • doureng6738 2016-12-31 11:01
    关注

    Issue solved. The code was correct. The problem was accidentally cross-linking two forms. I have two versions of my database one for production and one for testing. I had combined two tables into one (on both versions) and was correspondingly modifying the associated forms.

    Thank you for providing feedback. Getting the thoughts of others is very useful. Happy New Year.

    $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();
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历