【发布时间】:2013-02-06 21:53:21
【问题描述】:
在以下代码中,我收到以下错误:
无法获取 mysqli_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';这样替换数组中的键,那么一切正常!
如何将 NULL 值分配给数据库表中的列?
【问题讨论】:
-
你能粘贴一个关于 thumb_filename 列的 mysql 描述
-
user2023235:根据您提出的问题类型,我检查了是否检查了 assign null 选项......它没有!呃!!!休息时间!谢谢