线上网站开发相关书籍,wordpress 主题更改前台字体,临沂市建设局网站改版,海南响应式网站建设制作以下是我的HTML表单中的片段#xff0c;从相应的表行中提取选项。我想要做的是将第一个选项值设置为NULL#xff0c;因此当没有选择时#xff0c;将表单提交到数据库时输入NULL。Type:$sql mysql_query(SELECT type_id, type FROM $tbl_add_type) or die(mysql…以下是我的HTML表单中的片段从相应的表行中提取选项。我想要做的是将第一个选项值设置为NULL因此当没有选择时将表单提交到数据库时输入NULL。Type:$sql mysql_query(SELECT type_id, type FROM $tbl_add_type) or die(mysql_error());while ($row mysql_fetch_array($sql)){echo . $row[type] . ;}?*这可能吗还是有人建议一个更容易/更好的方法呢谢谢更新感谢您的答案我使用下面详细的方法将其转换为NULL。if ($_POST[location_id] ){$_POST[location_id] NULL;}但是当尝试使用这个NULL值与以下查询它不工作。UPDATE addresses SET location_idNULL WHERE ipid 4791我知道需要使用location_id NULL但不知道该怎么做更新2这是我的查询如何工作if ($_POST[location_id] ){$_POST[location_id] NULL; // or NULL for SQL}$notesisset($_POST[notes]) ? mysql_real_escape_string($_POST[notes]) : ;//$location_idisset($_POST[location_id]) ? mysql_real_escape_string($_POST[location_id]) : ;$ipidisset($_POST[ipid]) ? mysql_real_escape_string($_POST[ipid]) : ;$sqlUPDATE addressesSET notes$notes, location_id$location_idWHERE ipid $ipid;mysql_query($sql) or die(mysql_error());