php - How to print more than one query result rows in html table? -
i have code:
static function mcontent($chkbox){ $count = count($chkbox); foreach ($chkbox $value){ $count = count($value); for($i=0;$i>$count;$i++) { $sql = "select * `radio_city` chkid in (\"$value[$i]\")"; } } return db::select($sql);
i have checkboxes having dynamic id's in index page on table (in td),so when user clicks checkboxes posting values next page , sending values mysql query have shown above(to select more 2 rows depends on user selection),so sending values query fetch rows database , need print in html table.
array(8) { ["city"]=> string(1) "8" ["duration"]=> string(1) "0" ["frequency"]=> string(1) "0" ["hours"]=> string(1) "0" ["days"]=> string(1) "0" ["checkbox"]=> array(2) { [2]=> string(5) "bang2" [3]=> string(5) "bang3" } ["totlcost"]=> string(6) "rs 0/-" ["email"]=> string(25) "prasanna.mundas@gmail.com" } array(1) { [0]=> object(stdclass)#552 (9) { ["state"]=> string(9) "karnataka" ["city"]=> string(9) "bangalore" ["station"]=> string(15) "radio fever 104" ["language"]=> string(5) "hindi" ["reach"]=> string(5) "7.90%" ["rate"]=> string(3) "500" ["rank"]=> string(3) "181" ["idnum"]=> int(8) ["chkid"]=> string(5) "bang3" } }
i getting array how can print this
assuming using eloquent , blade
myfunction(){ $somearray = radiocity::wherein('chkid',$chkbox); return view::make('some.page',compact('somearray')); }
view
<table> <thead> <tr> <th>city</th> <th>duration</th> <th>yada yada</th> </tr> </thead> <tbody> @foreach($somearray $row) <tr> <td>{{ $row['city'] }} </td> <td>{{ $row['duration'] }} </td> <td>{{ $row['yadayada'] }} </td> </tr> @endforeach </tbody> </table>
Comments
Post a Comment