Php 我想使用数组的键为数据库表中的列指定一个空值。。。怎样?

Php 我想使用数组的键为数据库表中的列指定一个空值。。。怎样?,php,mysql,arrays,Php,Mysql,Arrays,在下面的代码中,我得到以下错误: 无法获取mysqli\u stmt // assign $title = 'this is the title'; $caption = 'description goes here...'; $filename = '43534b34.jpg'; $thumb = array(); $thumb['basename'] = null; $thumb['width'] = 0; $thumb['height'] = 0; // insert new reco

在下面的代码中,我得到以下错误:

无法获取mysqli\u stmt

// assign
$title = 'this is the title';
$caption = 'description goes here...';
$filename = '43534b34.jpg';

$thumb = array();
$thumb['basename'] = null;
$thumb['width'] = 0;
$thumb['height'] = 0;

// insert new record in db
$sql = 'INSERT INTO image (title, caption, filename, thumb_filename, thumb_width, thumb_height) VALUES(?, ?, ?, ?, ?, ?)';

$stmt = $conn->stmt_init();

$stmt->prepare($sql);
$stmt->bind_param('ssssii', $title, $caption, $filename, $thumb['basename'], $thumb['width'], $thumb['height']);
$stmt->execute();
如果我替换数组中的键,比如
$thumb['basename']='test',则一切正常

如何将空值分配给数据库表中的列?

试试看

$stmt->bind_param('ssssii', $title, $caption, $filename, empty($thumb['basename']) ? NULL : $thumb['basename'] , $thumb['width'], $thumb['height']);

你能粘贴一个mysql描述用户2023235的thumb_文件名列副本吗:根据你问的问题类型,我检查了assign null选项是否被选中。。。不是的!嗯!!!该休息了!谢谢