|
Panel Code Help
|
| afoster |
Posted on 04-08-2012 23:08
|

Senior Member

Posts: 425
Joined: 11/06/2007
|
I have the following code in a panel which works very well. What I would like to do is to have the number of records displayed as follows after opensidex(
Not Yet Paid - x number of players
Is this possible?
Codeif (!defined("IN_FUSION")) { die("Access Denied"); }
opensidex("Not Yet Paid");
$sql = dbquery("SELECT * FROM fusion_players12 Where paid=0 ORDER By name ASC");
echo '<br>
<table align="center" cellspacing="1" cellpadding="3" width="100%" class="tbl-border">
<tr class="tbl2"><td width="50%"><b><center>Name</b></td><td width="25%"><b><center>Owed</b></td><td width="25%"><b><center>Paid</b></td></tr>';
while($data = dbarray($sql))
{
echo '<tr class="tbl1"><td>'.$data['name'].'</td><td align="right">'.$data['total'].'</td><td align="right">'.$data['paid'].'</td></tr>';
}
echo '</table>
<br>';
closesidex();
|
| |
|
|
| Tyler |
Posted on 05-08-2012 00:07
|

Member

Posts: 167
Joined: 30/11/2011
|
Code$total_unpaid = dbrows($sql);
??????
Helping, would be pointing you in the right direction, not doing it all for you.
|
| |
|
|
| afoster |
Posted on 05-08-2012 00:24
|

Senior Member

Posts: 425
Joined: 11/06/2007
|
I see your signature block and understand what you are saying, however I have added your suggested code everywhere I could think of it to place it but it does not provide the display I am looking for. Can you point me in the direction of where it should be placed?
BTW, I appreciate your willingness to help. |
| |
|
|
| Craig |
Posted on 05-08-2012 00:57
|

Fusioneer

Posts: 3980
Joined: 27/09/2005
|
Hi afoster try this....
Code$not_paid = number_format(dbcount("(player_id)", DB_FUSION_PLAYERS12, "paid='0'"));
opensidex("Not Yet Paid - ".$not_paid);
I am not sure if player_id is the correct id you want to count but you get the idea.
|
| |
|
|
| afoster |
Posted on 05-08-2012 02:36
|

Senior Member

Posts: 425
Joined: 11/06/2007
|
Craig,
I'm sure I messed up somewhere because using your code, I get a blank where the number of players should be displayed. _First, I had to change DB_FUSION_PLAYERS12 to just fusion_players12 because it was throwing an error msg and then I changed player_id to just id because that is how the column is headed.
I entered your code right after the $sql=dbquery line...should it be entered somewhere else? |
| |
|
|
| Craig |
Posted on 05-08-2012 02:40
|

Fusioneer

Posts: 3980
Joined: 27/09/2005
|
Try this...
Code
if (!defined("IN_FUSION")) { die("Access Denied"); }
$not_paid = dbcount("(id)", fusion_players12, "paid='0'");
opensidex("Not Yet Paid - ".$not_paid);
$sql = dbquery("SELECT * FROM fusion_players12 Where paid=0 ORDER By name ASC");
echo '<br>
<table align="center" cellspacing="1" cellpadding="3" width="100%" class="tbl-border">
<tr class="tbl2"><td width="50%"><b><center>Name</b></td><td width="25%"><b><center>Owed</b></td><td width="25%"><b><center>Paid</b></td></tr>';
while($data = dbarray($sql))
{
echo '<tr class="tbl1"><td>'.$data['name'].'</td><td align="right">'.$data['total'].'</td><td align="right">'.$data['paid'].'</td></tr>';
}
echo '</table>
<br>';
closesidex();
|
| |
|
|
| afoster |
Posted on 05-08-2012 03:18
|

Senior Member

Posts: 425
Joined: 11/06/2007
|
That did it Craig...thank you. I am trying to add Players after the number but I can't seem to get a space between the number and players. It is showing up as 29players instead of 29 players.
BTW, you're up late aren't you? |
| |
|
|
| Craig |
Posted on 05-08-2012 10:49
|

Fusioneer

Posts: 3980
Joined: 27/09/2005
|
Try thats for a non-breaking space. 
Yes I was up late, celebrating Britain's success in the games.
|
| |
|
|
| afoster |
Posted on 05-08-2012 15:59
|

Senior Member

Posts: 425
Joined: 11/06/2007
|
Nope, I get the following error msg using
Parse error: syntax error, unexpected ';' in /hermes/bosweb/web099/b993/ipw.uname/public_html/sports/administration/panel_editor.php(153) : eval()'d code on line 3 |
| |
|
|
| Craig |
Posted on 05-08-2012 16:22
|

Fusioneer

Posts: 3980
Joined: 27/09/2005
|
Codeif (!defined("IN_FUSION")) { die("Access Denied"); }
$not_paid = dbcount("(id)", fusion_players12, "paid='0'");
opensidex("Not Yet Paid - ".$not_paid);
$sql = dbquery("SELECT * FROM fusion_players12 Where paid=0 ORDER By name ASC");
echo '<br>
<table align="center" cellspacing="1" cellpadding="3" width="100%" class="tbl-border">
<tr class="tbl2"><td width="50%"><b><center>Name</b></td><td width="25%"><b><center>Owed</b></td><td width="25%"><b><center>Paid</b></td></tr>';
while($data = dbarray($sql))
{
echo '<tr class="tbl1"><td>'.$data['name'].'</td><td align="right">'.$data['total'].'</td><td align="right">'.$data['paid'].'</td></tr>';
}
echo '</table>
<br>';
closesidex();
Code
opensidex("Not Yet Paid - ".$not_paid);
Yes?
|
| |
|
|
| afoster |
Posted on 05-08-2012 16:41
|

Senior Member

Posts: 425
Joined: 11/06/2007
|
What I would like to display is this:
Not Yet Paid - $not_paid players
Since I have not been able to do that without a space, I currently have the following:
Players Not Paid - $not_paid |
| |
|
|
| Craig |
Posted on 05-08-2012 17:03
|

Fusioneer

Posts: 3980
Joined: 27/09/2005
|
Codeopensidex("Not Yet Paid - ".$not_paid);
Do you mean here?
|
| |
|
|
| afoster |
Posted on 05-08-2012 17:09
|

Senior Member

Posts: 425
Joined: 11/06/2007
|
This is what I would like:
Codeopensidex("Not Yet Paid - ".$not_paid Players);
But that code throws an error msg. |
| |
|
|
| Craig |
Posted on 05-08-2012 17:21
|

Fusioneer

Posts: 3980
Joined: 27/09/2005
|
Of course, sorry... Here....
Code
opensidex("Not Yet Paid - ".$not_paid." Players");
|
| |
|
|
| afoster |
Posted on 05-08-2012 18:53
|

Senior Member

Posts: 425
Joined: 11/06/2007
|
That works Craig, thanks for your help. |
| |
|
|
| Craig |
Posted on 05-08-2012 19:15
|

Fusioneer

Posts: 3980
Joined: 27/09/2005
|
Your welcome.
|
| |
|