You are not logged in.

  • Login

1

Saturday, February 12th 2011, 11:44am

Spalte Addieren

so hab mal ne frage ich habe folgende ausgabe geschrieben mir fehlt noch was ich möchte da unten wo gesamt steht die marktwerte adieren lassen weis nur nicht wie ich das mache http://www.ngl-fifa.de/include.php?path=test hier damit ihr wisst was ich meine

mein Code:

PHP Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
if(!defined('pkFRONTEND') || pkFRONTEND!='public')
die('Direct access to this location is not permitted.');
if(!getrights('user'))
{
pkEvent('access_refused');
return;
}
$sname = pkgetconfig('site_name');
$query = "SELECT _spi,_nr,_pos,_st,_ver,_mkw,_bem FROM ".phpkit_spieler." WHERE _ver LIKE 'SV Werder Bremen' ORDER BY _nr ";
$test = $SQL->query($query);
while ($row = $SQL->fetch_array($test)){
eval("\$lm10_row.=\"".pkTpl("lm10_row")."\";");
 
 
 
}
 
echo'<table class="heads" align="center" width="100%" cellspacing="0" cellpadding="4">
<tr>
<th class="heads" width="20%" nowrap="nowrap" align="left">Spieler</th>
<th class="heads" width="5%" nowrap="nowrap" align="left">Position</th>
<th class="heads" width="5%" nowrap="nowrap" align="left">Stärke</th>
<th class="heads" width="25%" nowrap="nowrap" align="left">Verein</th>
<th class="heads" width="15%" nowrap="nowrap" align="left">Marktwert in Euro</th>
<th class="heads" width="25%" nowrap="nowrap" align="left">Bemerkung</th>
</tr>
'.$lm10_row.'
 
tr>
<th class="heads" width="20%" nowrap="nowrap" align="left"></th>
<th class="heads" width="5%" nowrap="nowrap" align="left"></th>
<th class="heads" width="5%" nowrap="nowrap" align="left"></th>
<th class="heads" width="25%" nowrap="nowrap" align="left">Gesamt</th>
<th class="heads" width="15%" nowrap="nowrap" align="left"></th>
<th class="heads" width="25%" nowrap="nowrap" align="left"></th>
</table>';
 
?>

2

Saturday, February 12th 2011, 2:42pm

pkTpl scheint auf die globale Variable $test zuzugreifen. Du kannst die Werte ja vorübergehend in ein Array $test2 aufaddieren.
Und dann im letzten Schritt $test mit $test2 überschreiben.

Beispiel für #14: $test2['zahl'] += $test['zahl']

3

Saturday, February 12th 2011, 5:34pm

so bewandert bin ich dann auch nicht ich habe mich wohl falsch ausgedrückt ich habe das script von jemanden und ich weiß eigendlich mit den befehlen nichts anzufangen.

4

Saturday, February 12th 2011, 7:59pm

Wieso nicht direkt in der Abfrage?

SQL Code

1
SELECT  SUM(_mkw) AS gesamtMarktwert

5

Saturday, February 12th 2011, 9:07pm

kommt immer syntax error

6

Sunday, February 13th 2011, 12:59pm

SQL Code

1
2
3
4
SELECT  _spi, _nr, _pos, _st, _ver, _mkw, _bem, SUM(_mkw) AS gesamtMarktwert
  FROM ".phpkit_spieler."
	WHERE _ver LIKE 'SV Werder Bremen'
	ORDER BY _nr

7

Monday, February 14th 2011, 5:05pm

super danke ich bedanke mich ich möchte nur eines die summe soll unten in die tabelle da steht schon gesamt und da drunter muss das rein

okay ich danke euch aber ich glaube das ich es aufgeben weil das alles net funzt also nochma danke für die hilfe

PHP Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
if(!defined('pkFRONTEND') || pkFRONTEND!='public')
        die('Direct access to this location is not permitted.');
if(!getrights('user'))
    {
    pkEvent('access_refused');
    return;
    }
$sname = pkgetconfig('site_name');
$query = "SELECT _spi,_nr,_pos,_st,_ver,_mkw,_bem SUM(_mkw) AS gesamtMarktwert FROM ".phpkit_spieler." WHERE _ver LIKE 'SV Werder Bremen' ORDER BY _nr ";
$test = $SQL->query($query);
while ($row = $SQL->fetch_array($test)){
    eval("\$lm10_row.=\"".pkTpl("lm10_row")."\";");
}
 
echo'<table class="heads" align="center" width="100%" cellspacing="0" cellpadding="4">
<tr>
 <th class="heads" width="20%" nowrap="nowrap" align="left">Spieler</th>
 <th class="heads" width="5%" nowrap="nowrap" align="left">Position</th>
 <th class="heads" width="5%" nowrap="nowrap" align="left">Stärke</th>
 <th class="heads" width="25%" nowrap="nowrap" align="left">Verein</th>
 <th class="heads" width="15%" nowrap="nowrap" align="left">Marktwert in Euro</th>
 <th class="heads" width="25%" nowrap="nowrap" align="left">Bemerkung</th>
</tr>
'.$lm10_row.'
 
 
 
<tr>
 <th class="heads" width="20%" nowrap="nowrap" align="left"></th>
 <th class="heads" width="5%" nowrap="nowrap" align="left"></th>
 <th class="heads" width="5%" nowrap="nowrap" align="left"></th>
 <th class="heads" width="25%" nowrap="nowrap" align="left">Gesamt</th>
 <th class="heads" width="15%" nowrap="nowrap" align="left">'.$lm11_row.'</th>
 <th class="heads" width="25%" nowrap="nowrap" align="left"></th>
</table>';
 
?>


das ist mein aktueller code und was dabei raus kommt seht ihr hier test

8

Monday, February 14th 2011, 7:49pm

"Zugriff verweigert"

9

Tuesday, February 15th 2011, 6:55pm

oh mann ich glaube das was ich möchte geht gar nicht oder ich glaube das geht nicht danke für eure hilfe

Similar threads

Social bookmarks