PHP implode and explode concept - Mostlikers

03 March, 2014

PHP implode and explode concept

This concept based on multiple value to store on array function. its post to the database after that value fetch explode mode. previously fetch the value on array function but unlimited array value not possible to fetch array function. so follow this to learn about foreach mode fetch array function.



using array to collect the similar data in select box Ex; Multiple city

    $insert=mysql_query("insert into location (engines) values ('$palce')");
<html xmlns="">
<form  method="post"><p><select name="palce[]" multiple="multiple"  style="width:200px">
<option value="google">google</option>
<option value="yahoo">yahoo</option>
<option value="Awasome">Awasome</option>
<p><input type="submit" value="submit" name="submit" /></p></form>
$result_opt = mysql_query("select * from location ") or die(mysql_error());
while($data_opt = mysql_fetch_array($result_opt)){     
 $id = $data_opt['id'];
 $place1 = $data_opt['engine'];  
 $place2 = explode(',',$place1);
 $count1 = count($place2);

<tr><td><?php  echo $id ?></td><td><?php for($i=0; $i<$count1; $i++){ echo $place2[$i].",";}?></td></tr>

<?php } 

No comments:

Post a Comment