php – mysqli bind_param中的NULL类型是什么?
发布时间:2020-05-25 08:50:15 所属栏目:PHP 来源:互联网
导读:我试图将params绑定到INSERT INTO MySQLi预处理语句,如果该变量存在,否则插入null.然后我知道 type variablei corresponding variable has type integerd corresponding variable has type doubles corresponding variable has type
|
我试图将params绑定到INSERT INTO MySQLi预处理语句,如果该变量存在,否则插入null.然后我知道 type variable i corresponding variable has type integer d corresponding variable has type double s corresponding variable has type string b corresponding variable is a blob and will be sent in packets 但是当我插入一个变量= null时,我如何定义变量的类型?或者我应该定义类型”? 您不需要将null转换为特定的数据类型 – Mysqli将处理传递给任何接受的数据类型的空值,因此只要使用每个字段在传递非空值时所具有的类型.$intVar = null;
$doubleVar = null;
$stringVar = null;
$blobVar = null;
$insert_data->bind_param('idsb',$intVar,$doubleVar,$stringVar,$blobVar);
所有这些都是有效的,并将被Mysqli接受. (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
