php - Only single record getting when i fetch data from another page -
i have created php page fetch data mysql , have page show data on webpage.... have php page page_1.php
<?php include_once'db_localconnection.php'; $query="select * `table 5` base='home plans'"; $get_allplans=mysql_query($query) or die(mysql_error()); while($fetch=mysql_fetch_array($get_allplans)) { $plans_code=$fetch['plan_code']; $speed=$fetch['speed']; $data=$fetch['data']; $duration=$fetch['duration']; $gb_pm=$fetch['gb_pm']; $up_speed=$fetch['up_speed']; $price=$fetch['price']; $base=$fetch['base']; } ?>
and have page show data have include needed pages
<td><?php echo $plans_code; ?></td> <td><?php echo $speed; ?></td> <td><?php echo $data; ?></td> <td class="center"><?php echo $duration; ?></td> <td class="center"><?php echo $gb_pm; ?></td> <td><?php echo $up_speed; ?></td> <td><?php echo $price; ?></td> <td><a href="#">get reacharge</a></td>
so getting first record please help..
you storing values db variables i.e $plans_code, etc. in while statement overwriting values each time loop. instead, store them array , send second page , display them.
example:
$completedata = array(); while($row=mysql_fetch_array($get_allplans)) { array_push($completedata, $row); }
now fetch array $completedata second page , display it, like:
<?php foreach($completedata $row) { ?> <tr> <td><?php echo $row['plans_code']; ?></td> <td><?php echo $row['speed']; ?></td> . . . </tr> <?php } ?>
Comments
Post a Comment