更新时间:2022-01-23 22:16:08
将多个值插入单个字段:
要在一个字段中插入单位号,请使用implode
并将值用逗号分隔.
For inserting the flat no's in a single field, use implode
and the values separated by comma.
$r=implode(",",$available);
$insert=mysql_query("insert into flatdetails(available) value ('$r')")
要从数据库中检索值,请使用explode
分隔所有值.
For retrieve the values from database use, explode
to separate out all the values..
用于使用检索值 $ i = explode(,",$ r);
<?php
$select_tbl=mysql_query("select * from flatdetails",$conn);
while($fetch=mysql_fetch_object($select_tbl))
{
$r=$fetch->available;
$i=explode(",",$r);
echo $i[0]."</br>";
}
?>