view raw
Imran Khan Imran Khan - 10 months ago 36
SQL Question

how to insert multiple of values in a single field in mysql

i want to insert multiple values into a single field, i don't know how to achieve this i'm using a long-text data type field. And also tell me how to fetch these a value only one separate value at a time.


Insert Mutliple values in a single Field:

For inserting the flat no's in a single field, use implode and the values separated by comma.

$insert=mysql_query("insert into flatdetails(available) value ('$r')")

For retrieve the values from database use, explode to separate out all the values..

For Retrieve the values using $i=explode(",",$r);

$select_tbl=mysql_query("select * from flatdetails",$conn);


echo $i[0]."</br>";