# Current Bids (On frontpage)

**URL:** <https://forum.phpvms.net/t/current-bids-on-frontpage/2218>\
**Category:** Code Snippets\
**Created:** [March 14, 2010, 8:23pm UTC](https://forum.phpvms.net/t/current-bids-on-frontpage/2218 "2010-03-14T20:23:06Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![saapilot](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/s/91b2a8/32.png) [@saapilot](https://forum.phpvms.net/u/saapilot)\
**Post date:** [March 14, 2010, 8:23pm UTC](https://forum.phpvms.net/t/current-bids-on-frontpage/2218/1 "2010-03-14T20:23:06Z")

</div>

Good day,

I’m trying to display current bids, in table format, in the main body of the front page without much luck. The problem is that no data is displayed even though there are bids, there are also no error messages displayed. Any help would be greatly appreciated.

> \<div id=“mainbox”\>
> 
> \<h3\>Flight Departures Board\</h3\>
> 
> \<table width=“100%” class=“tablesorter”\>
> 
> \<thead\>
> 
> \<tr bgcolor=“#336699”\>
> 
> \<th height=“25” width=“10%”\>\<div align=“center”\>Flight Number\</div\>\</th\>
> 
> \<th height=“25” width=“10%”\>\<div align=“center”\>Pilot ID\</div\>\</th\>
> 
> \<th height=“25” width=“30%”\>\<div align=“center”\>Aircraft Type\</div\>\</th\>
> 
> \<th height=“25” width=“10%”\>\<div align=“center”\>Tail No.\</div\>\</th\>
> 
> \<th height=“25” width=“15%”\>\<div align=“center”\>Depart Airport\</th\>
> 
> \<th height=“25” width=“15%”\>\<div align=“center”\>Arrive Airport\</div\>\</th\>
> 
> \<th height=“25” width=“10%”\>\<div align=“center”\>Flight Time\</div\>\</th\>
> 
> \</tr\>
> 
> \</thead\>
> 
> \<tbody\>
> 
> \<?php
> 
> if(!$bids)
> 
> {
> 
> echo ‘No flights have currently been booked’;
> 
> return;
> 
> }
> 
> foreach($bids as $bid);
> 
> {
> 
> ?\>
> 
> \<tr bgcolor=“#DFF4FF”\>
> 
> \<td height=“25” width=“10%” align=“center”\>\<?php echo $bid-\>code . $bid-\>flightnum; ?\>\</a\> \</td\>
> 
> \<?php
> 
> $params = $bid-\>pilotid;
> 
> $pilot = PilotData::GetPilotData($params);
> 
> $pname = $pilot-\>firstname;
> 
> $psurname = $pilot-\>lastname;
> 
> ?\>
> 
> \<td height=“25” width=“10%” align=“center”\>\<span\>\<?php echo $pname; ?\> \<?php echo $psurname; ?\>\</span\>\</td\>
> 
> \<td height=“25” width=“30%” align=“center”\>\<span\>\<?php echo $bid-\>aircraft; ?\>\</span\>\</td\>
> 
> \<td height=“25” width=“10%” align=“center”\>\<?php echo $bid-\>registration?\>\</td\>
> 
> \<td height=“25” width=“15%” align=“center”\>\<span\>\<?php echo $bid-\>depicao; ?\>\</span\>\</td\>
> 
> \<td height=“25” width=“15%” align=“center”\>\<span\>\<?php echo $bid-\>arricao; ?\>\</span\>\</td\>
> 
> \<td height=“25” width=“10%” align=“center”\>\<span\>\<?php echo $bid-\>flighttime; ?\> Hours\</span\>\</td\>
> 
> \</tr\>
> 
> \<?php
> 
> }
> 
> ?\>
> 
> \</tbody\>
> 
> \</table\>
> 
> \<hr\>
> 
> \</div\>

Many thanks

Mark

---

<div class="post-metadata">

**Author:** ![nabeel](https://forum.phpvms.net/user_avatar/forum.phpvms.net/nabeel/32/2971_2.png) [@nabeel](https://forum.phpvms.net/u/nabeel)\
**Post date:** [March 15, 2010, 12:12am UTC](https://forum.phpvms.net/t/current-bids-on-frontpage/2218/2 "2010-03-15T00:12:33Z")

</div>

You have a semi-colon at the end of hte foreach:

```
foreach($bids as $bid);

```

That could be it.

---

<div class="post-metadata">

**Author:** ![saapilot](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/s/91b2a8/32.png) [@saapilot](https://forum.phpvms.net/u/saapilot)\
**Post date:** [March 15, 2010, 1:44pm UTC](https://forum.phpvms.net/t/current-bids-on-frontpage/2218/3 "2010-03-15T13:44:41Z")

</div>

Thanks Nabeel,

That worked, I also had to change the reference from “bid” to “lastbid”

Mark

---

<div class="post-metadata">

**Author:** ![mark1million](https://forum.phpvms.net/user_avatar/forum.phpvms.net/mark1million/32/15_2.png) [@mark1million](https://forum.phpvms.net/u/mark1million)\
**Post date:** [March 15, 2010, 5:35pm UTC](https://forum.phpvms.net/t/current-bids-on-frontpage/2218/4 "2010-03-15T17:35:08Z")

</div>

Could you post the working code?

Maybe then the mods could move this little gem to code snippets

---

<div class="post-metadata">

**Author:** ![saapilot](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/s/91b2a8/32.png) [@saapilot](https://forum.phpvms.net/u/saapilot)\
**Post date:** [March 15, 2010, 7:00pm UTC](https://forum.phpvms.net/t/current-bids-on-frontpage/2218/5 "2010-03-15T19:00:35Z")

</div>

Here’s the working code, to go into frontpage\_recentbids.tpl

> \<div id=“mainbox”\>
> 
> \<h3\>Flight Departures Board\</h3\>
> 
> \<?php
> 
> if(!$lastbids)
> 
> {
> 
> echo ‘\<p align=“center”\>No flights have currently been booked\</p\>’;
> 
> return;
> 
> }
> 
> ?\>
> 
> \<table width=“100%” class=“tablesorter”\>
> 
> \<thead\>
> 
> \<tr bgcolor=“#336699”\>
> 
> \<th height=“25” width=“15%”\>\<div align=“center”\>Flight Number\</div\>\</th\>
> 
> \<th height=“25” width=“13%”\>\<div align=“center”\>Depart\</div\>\</th\>
> 
> \<th height=“25” width=“13%”\>\<div align=“center”\>Arrive\</div\>\</th\>
> 
> \<th height=“25” width=“20%”\>\<div align=“center”\>Pilot Name\</div\>\</th\>
> 
> \<th height=“25” width=“15%”\>\<div align=“center”\>Aircraft\</th\>
> 
> \<th height=“25” width=“12%”\>\<div align=“center”\>Tail No.\</div\>\</th\>
> 
> \<th height=“25” width=“12%”\>\<div align=“center”\>Flight Time\</div\>\</th\>
> 
> \</tr\>
> 
> \</thead\>
> 
> \<tbody\>
> 
> \<?php
> 
> foreach($lastbids as $lastbid)
> 
> {
> 
> ?\>
> 
> \<tr bgcolor=“#DFF4FF”\>
> 
> \<td height=“25” width=“15%” align=“center”\>\<?php echo $lastbid-\>code . $lastbid-\>flightnum; ?\>\</a\> \</td\>
> 
> \<td height=“25” width=“13%” align=“center”\>\<span\>\<?php echo $lastbid-\>depicao; ?\>\</span\>\</td\>
> 
> \<td height=“25” width=“13%” align=“center”\>\<span\>\<?php echo $lastbid-\>arricao; ?\>\</span\>\</td\>
> 
> \<?php
> 
> $params = $lastbid-\>pilotid;
> 
> $pilot = PilotData::GetPilotData($params);
> 
> $pname = $pilot-\>firstname;
> 
> $psurname = $pilot-\>lastname;
> 
> ?\>
> 
> \<td height=“25” width=“20%” align=“center”\>\<span\>\<?php echo $pname; ?\> \<?php echo $psurname; ?\>\</span\>\</td\>
> 
> \<td height=“25” width=“15%” align=“center”\>\<span\>\<?php echo $lastbid-\>aircraft; ?\>\</span\>\</td\>
> 
> \<td height=“25” width=“12%” align=“center”\>\<?php echo $lastbid-\>registration?\>\</td\>
> 
> \<td height=“25” width=“12%” align=“center”\>\<span\>\<?php echo $lastbid-\>flighttime; ?\> Hours\</span\>\</td\>
> 
> \</tr\>
> 
> \<?php
> 
> }
> 
> ?\>
> 
> \</tbody\>
> 
> \</table\>
> 
> \<hr\>
> 
> \</div\>

Add the following to frontpage\_main.tpl

> MainController::Run(‘FrontBids’, ‘RecentFrontPage’, 5);

---

<div class="post-metadata">

**Author:** ![Matthew\_Talbot](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/m/e56c9b/32.png) [@Matthew\_Talbot](https://forum.phpvms.net/u/Matthew_Talbot)\
**Post date:** [June 2, 2010, 3:11pm UTC](https://forum.phpvms.net/t/current-bids-on-frontpage/2218/6 "2010-06-02T15:11:54Z")

</div>

Thanx mate, worked a treat

---

<div class="post-metadata">

**Author:** ![Matthew\_Talbot](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/m/e56c9b/32.png) [@Matthew\_Talbot](https://forum.phpvms.net/u/Matthew_Talbot)\
**Post date:** [June 2, 2010, 3:21pm UTC](https://forum.phpvms.net/t/current-bids-on-frontpage/2218/7 "2010-06-02T15:21:48Z")

</div>

is this for use with Obsess Blue, I prefer crystal as when I just tested out the code, I could only see half of the recent bids on the home page

Many Thanks,

Matthew

---

<div class="post-metadata">

**Author:** ![dale0404](https://forum.phpvms.net/user_avatar/forum.phpvms.net/dale0404/32/76_2.png) [@dale0404](https://forum.phpvms.net/u/dale0404)\
**Post date:** [June 2, 2010, 7:39pm UTC](https://forum.phpvms.net/t/current-bids-on-frontpage/2218/8 "2010-06-02T19:39:14Z")

</div>

> is this for use with Obsess Blue, I prefer crystal as when I just tested out the code, I could only see half of the recent bids on the home page
> 
> Many Thanks,
> 
> Matthew

Do you mean you only see half the table horizontally? If so then change the following:

```
<table width="100%" class="tablesorter">

```

to

```
<table width="700" class="tablesorter">

```

---

<div class="post-metadata">

**Author:** ![AUZ](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/a/2acd7d/32.png) [@AUZ](https://forum.phpvms.net/u/AUZ)\
**Post date:** [June 3, 2010, 2:10am UTC](https://forum.phpvms.net/t/current-bids-on-frontpage/2218/9 "2010-06-03T02:10:26Z")

</div>

Thanks

Works a treat!

---

<div class="post-metadata">

**Author:** ![Matthew\_Talbot](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/m/e56c9b/32.png) [@Matthew\_Talbot](https://forum.phpvms.net/u/Matthew_Talbot)\
**Post date:** [June 4, 2010, 6:24pm UTC](https://forum.phpvms.net/t/current-bids-on-frontpage/2218/10 "2010-06-04T18:24:12Z")

</div>

> Thanks
> 
> Works a treat!

Thats my word

---

<div class="post-metadata">

**Author:** ![Matthew\_Talbot](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/m/e56c9b/32.png) [@Matthew\_Talbot](https://forum.phpvms.net/u/Matthew_Talbot)\
**Post date:** [June 4, 2010, 6:25pm UTC](https://forum.phpvms.net/t/current-bids-on-frontpage/2218/11 "2010-06-04T18:25:09Z")

</div>

It does not show up on my frontpage all that appears is

```
MainController::Run('FrontBids', 'RecentFrontPage', 5);

```

---

<div class="post-metadata">

**Author:** ![simpilot](https://forum.phpvms.net/user_avatar/forum.phpvms.net/simpilot/32/26_2.png) [@simpilot](https://forum.phpvms.net/u/simpilot)\
**Post date:** [June 5, 2010, 3:14pm UTC](https://forum.phpvms.net/t/current-bids-on-frontpage/2218/12 "2010-06-05T15:14:28Z")

</div>

> It does not show up on my frontpage all that appears is
> 
> MainController::Run(‘FrontBids’, ‘RecentFrontPage’, 5);

It probably needs to be wrapped in php tags

```
<?php MainController::Run('FrontBids', 'RecentFrontPage', 5); ?>

```

---

<div class="post-metadata">

**Author:** ![Harryh](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/h/d26b3c/32.png) [@Harryh](https://forum.phpvms.net/u/Harryh)\
**Post date:** [June 27, 2010, 11:36pm UTC](https://forum.phpvms.net/t/current-bids-on-frontpage/2218/13 "2010-06-27T23:36:14Z")

</div>

Hey im using this code and ive Added some Bids and i still get the same message “No flights have currently been booked” Please Help this page can be located [http://jet-magic.co.uk/phpvms/index.php/pages/bookedflights](http://jet-magic.co.uk/phpvms/index.php/pages/bookedflights)

---

<div class="post-metadata">

**Author:** ![Jeff](https://forum.phpvms.net/user_avatar/forum.phpvms.net/jeff/32/78_2.png) [@Jeff](https://forum.phpvms.net/u/Jeff)\
**Post date:** [July 1, 2010, 4:54pm UTC](https://forum.phpvms.net/t/current-bids-on-frontpage/2218/14 "2010-07-01T16:54:25Z")

</div>

> Hey im using this code and ive Added some Bids and i still get the same message “No flights have currently been booked” Please Help this page can be located [http://jet-magic.co.uk/phpvms/index.php/pages/bookedflights](http://jet-magic.co.uk/phpvms/index.php/pages/bookedflights)

Harry, this is everything I have done to get it to show up on my main page.

this is the whole code in /home/yoursite/public\_html/core/templates/frontpage\_recentbids.tpl

```
<div id="mainbox">
<h3><img src="http://www.oneworldvs.net/lib/images/icons/flights.jpg">Flight Departures Board</h3>

<?php
if(!$lastbids)
{
echo '<p align="center">No flights have currently been booked</p>';
return;
}
?>

<table width="100%" border="1" bordercolor="#FFFFFF" class="tablesorter" id="tabledlist">
<thead>
<tr align="center" valign="middle" bgcolor="#0079B2">
<th height="25" width="15%"><div align="center">Flight Number</div></th>
<th height="25" width="13%"><div align="center">Depart</div></th>
<th height="25" width="13%"><div align="center">Arrive</div></th>
<th height="25" width="20%"><div align="center">Pilot Name</div></th>
<th height="25" width="15%"><div align="center">Aircraft</th>
<th height="25" width="12%"><div align="center">Tail No.</div></th>
<th height="25" width="12%"><div align="center">Flight Time</div></th>
</tr>
</thead>
<tbody>
<?php

foreach($lastbids as $lastbid)
{
?>
<tr align="center" valign="middle" bgcolor="#DFF4FF">
<td height="25" width="15%" align="center"><?php echo $lastbid->code . $lastbid->flightnum; ?></a> </td>
<td height="25" width="13%" align="center"><span><?php echo $lastbid->depicao; ?></span></td>
<td height="25" width="13%" align="center"><span><?php echo $lastbid->arricao; ?></span></td>

<?php
$params = $lastbid->pilotid;

$pilot = PilotData::GetPilotData($params);
$pname = $pilot->firstname;
$psurname = $pilot->lastname;
?>
<td height="25" width="20%" align="center"><span><?php echo $pname; ?> <?php echo $psurname; ?></span></td>
<td height="25" width="15%" align="center"><span><?php echo $lastbid->aircraft; ?></span></td>
<td height="25" width="12%" align="center"><?php echo $lastbid->registration?></td>
<td height="25" width="12%" align="center"><span><?php echo $lastbid->flighttime; ?> Hours</span></td>
</tr>
<?php
}
?>
</tbody>
</table>
<hr>
</div>

```

Now, in the page you want it to show, place this code:

```
<?php MainController::Run('FrontBids', 'RecentFrontPage', 5); ?>

```

The number 5 can be changed to any number to show how many bids you want to show at one time.

---

<div class="post-metadata">

**Author:** ![Harryh](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/h/d26b3c/32.png) [@Harryh](https://forum.phpvms.net/u/Harryh)\
**Post date:** [July 11, 2010, 9:55am UTC](https://forum.phpvms.net/t/current-bids-on-frontpage/2218/15 "2010-07-11T09:55:55Z")

</div>

Hey Thank you soo much working perfectly now (:
