有人可以帮助我,我已经坚持了很长一段时间,对此我也很陌生。我有一个表(tbl_call_log_detail),其中包含2个外键(dealer_id引用tbl_dealer_info中的id和type_of_call引用tbl_call_types中的id)。我正在尝试更新我的表单,它正常工作。然后我希望更新中的相关字段自动插入到tbl_call_log_detail。这就是我在失去理智
$query = "SELECT id FROM tbl_dealer_info WHERE account_name = '$account_name' INTO $dealer_id";
$result = mysqli_query($conn, $query);
$query2 = "SELECT id FROM tbl_call_types WHERE type_of_call = '$type_of_call' INTO $type_of_call";
$result2 = mysqli_query($conn, $query2);
$sql = "INSERT INTO tbl_call_log_detail ";
$sql .= "(comment, time_stamp, type_of_call, dealer_id) ";
$sql .= "VALUES ";
$sql .= "('$_POST[comments]', '$_POST[time_stamp]', '$type_of_call', '$dealer_id') ";
mysqli_query($conn, $sql);
}
当我回显我的Insert语句然后将其粘贴到phpmyadmin上时,我收到错误
'Incorrect integer value: change in region' for column 'type_of_call'
答案 0 :(得分:1)
'不正确的整数值:区域变化'列' type_of_call
type_of_call
列中的integer
,您尝试在其中插入'change in region'
,string
值。