时间:2021-07-01 10:21:17 帮助过:4人阅读
mysqli_stmt_bind_param($stmt, 'idii', $c, $a, $t, $w);
1)) ) { $c = mysqli_real_escape_string ($conn, $trimmed['city']);; } else { $errors[] = '请选择区域'; } if (is_numeric($trimmed['taoshu']) && ($trimmed['taoshu'] > 0)) { $t = mysqli_real_escape_string ($conn, (int) $trimmed['taoshu']); } else { $errors[] = '请输入一个正确的套数'; } if (is_numeric($trimmed['area']) && ($trimmed['area'] > 0)) { $a = mysqli_real_escape_string ($conn, (float) $trimmed['area']); } else { $errors[] = '请输入一个正确的面积'; } if (empty($errors)) { $q = 'INSERT INTO f_chengjiao (city_id, area, taoshu, fang_time, os_time) VALUES (?, ?, ?, ?, ?, NOW())'; $stmt = mysqli_prepare($conn, $q); mysqli_stmt_bind_param($stmt, 'idii', $c, $a, $t, $w); mysqli_stmt_execute($stmt); if (mysqli_stmt_affected_rows($stmt) == 1) { echo '这条数据已经被添加
'; $_POST = array(); } else { echo '程序发生错误,请重新添加
'; } mysqli_stmt_close($stmt); } } if ( !empty($errors) && is_array($errors) ) { echo '发生下列错误:
';}?> 住宅数据添加
'; foreach ($errors as $msg) { echo " - $msg
\n"; } echo '请在试一遍
出错文件是 'D:\wamp\www\zhuzhai_add.php' 出错行号是 36: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean givenDate/Time: 9-11-2014 03:52:53Array( [_GET] => Array ( ) [_POST] => Array ( [wdate] => 2014-09-11 [city] => 1 [taoshu] => 50 [area] => 10000 [submit] => ) [_COOKIE] => Array ( ) [_FILES] => Array ( ) [_ENV] => Array ( ) [_REQUEST] => Array ( [wdate] => 2014-09-11 [city] => 1 [taoshu] => 50 [area] => 10000 [submit] => )
你的$conn 在哪初始化的? 且inser 语句的字段与值个数没匹配上吧。
mysqli_stmt_bind_param($stmt, 'idi s', $c, $a, $t, $w);
你的$conn 在哪初始化的? 且inser 语句的字段与值个数没匹配上吧。
mysqli_stmt_bind_param($stmt, 'idi s', $c, $a, $t, $w);
你的$conn 在哪初始化的? 且inser 语句的字段与值个数没匹配上吧。
贴出修改后的sql串和错误信息