php - Display mysql database query result on second pages -
i have mysql database data.here display data on 1 page want display data on next page please give me suggestion how can ......... need modifications in code want display table table on next page(book.php page populated database)......
second thing need know possible store value of calendar in session variable (is ???than how?)
<?php if(isset($_post['search'])){ $from = $_post['from']; $to = $_post['to']; $query = mysql_query("select * schedule destinatio='$from' , arriva ='$to'"); $c = mysql_num_rows($query); if (!$query) { die('invalid query: ' . mysql_error()); } if($c>0) { ?> <table> <tr align="center"><td width="120"><span class="style23">destination</span> </td> <td width="57"><span class="style23">arrival</span></td> <td width="121"><span class="style23">departure time</span></td> <td width="98"><span class="style23">arrival time</span></td> <td width="44"><span class="style23">fare</span></td> <td width="85"><span class="style23">bus_type</span></td> <td width="84"><span class="style23">total_seats</span></td> <td width="81"><span class="style23">available</span></td> <td width="52"> </td> </tr> </section> <?php while($r1 = mysql_fetch_array($query)) { $schedule= $r1['id']; $destinatio = $r1['destinatio']; $arriva= $r1['arriva']; $departure_time = $r1['departure_time']; $arrival_time = $r1['arrival_time']; $fare = $r1['fare']; $bus_type = $r1['bus_type']; $total_seats = $r1['total_seats']; $bust = $schedule.'schedule'; $query1 = mysql_query("select * $bust status='available'"); echo $query1; if (!$query1) { die('invalid query: ' . mysql_error()); } $c = mysql_num_rows($query1); ?> <tr align="center"><td><?php echo $destinatio;?></td><td><?php echo $arriva;?></td><td><?php echo $departure_time;?></td><td><?php echo $arrival_time;?></td><td><?php echo $fare;?></td><td nowrap="nowrap"><?php echo $bus_type;?></td><td><?php echo $c;?></td><td><a href="book.php?id=<?php echo $uid;?>&bus=<?php echo $schedule;?>">book</a> </td> </tr></table> </form>
there 3 main ways pass variables:
- using form button using $_post variables pass content (generally best when have user input).
- using html anchor link pass variables through $_get
- using session variable can accessed on pages on site.
using session variables more secure way, data isn't secret use $_get method.
to store in session variable need use:
start_session(); $_session['varname'] = value;
on following page, can read session variable using it's name. example:
start_session(); echo $_session['varname'];
Comments
Post a Comment