Versio

Class meerdere keren gebruiken

Overzicht Reageren

Chris visser

chris visser

09/01/2009 12:14:00
Quote Anchor link
Hey. Ik heb op een pagina een functie staan die verwijst naar een class. Deze word zonder problemen uitgevoerd. Nu wil ik diezelfde functie weer gebruiken voor een andere waarde, maar nu krijg ik helemaal niets te zien. Mijn layout is alsvolgt:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
<?php
functie test($waarde1, $waarde2, $waarde3)
{

  $test = $class -> iets ( );
  echo "test";
}


test(1,2,3);
echo "<p>";
test(5,6,7);
echo ?>


Het kan zijn dat ik nu uitgescholden word over classes en dat ik ze niet begrijp enz, maar ik kan ze hebben :)
Gewijzigd op 01/01/1970 01:00:00 door Chris visser
 
PHP hulp

PHP hulp

17/05/2012 12:43:17
Gesponsorde koppelingen:
 
RvW Of toch niet

RvW Of toch niet

09/01/2009 12:18:00
Quote Anchor link
zo ie zo is het function en doe je en echo voor nix ....
 
Mitchell

Mitchell

09/01/2009 12:21:00
Quote Anchor link
Offtopic:

Ik scheld je uit over het feit dat je de <p> tag niet afsluit. :)
!@##$%
 
Joren de Wit
Beheerder

Joren de Wit

09/01/2009 12:25:00
Quote Anchor link
De variabele $class zal niet bestaan binnen je functie, die heb je immers nog nergens gedeclareerd. Als je dat buiten je functie doet, zul je $class global moeten maken:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
<?php
function test(...)
{

    global $class;

    // rest van je functie
}
?>

Verder doe je niets met de parameters die je opgeeft?
 
Dennis Mertens

Dennis Mertens

09/01/2009 12:30:00
Quote Anchor link
rvw schreef op 09.01.2009 12:18:
zo ie zo is het function en doe je en echo voor nix ....
Het is sowieso ;)

Blanche schreef op 09.01.2009 12:25:
Verder doe je niets met de parameters die je opgeeft?
Dat komt later nog denk ik, maar aangezien hij nu al vast loopt.
 
Chris visser

chris visser

09/01/2009 12:32:00
Quote Anchor link
nee ok ik had deze ff snel gemaakt als test. Het gaat om het feit dat ik een functie die van een class gebruik maakt meerdere keren wil uitvoeren. De functie doet het gewoon. Alleen wil ik hem nu meerdere keren uitvoeren op 1 pagina dus door:

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
<?php
//Eerste uitvoer
test('waarde1', 'waarde2', 'waarde3');
echo "<p>";
// Voor mitchel :D
echo "</p>";
//Volgende uitvoer
test('waarde4', 'waarde5', 'waarde6');
?>
 
Joren de Wit
Beheerder

Joren de Wit

09/01/2009 12:35:00
Quote Anchor link
Ik zie niet in waarom dat niet zou werken? Wat gaat er precies fout?
 
Chris visser

chris visser

09/01/2009 12:43:00
Quote Anchor link
Misschien moet ik iets meer informatie geven. Ik denk nu namelijk waar het aan ligt. De functie is de KNVB ripper die ik gisteren in de scripts postte. Hij doet het bij mij perfect doordat ik de class met een functie oproep.
-Geeft hij geen resultaat: header("location: index.php"). (pagina vernieuwen)
-Wel resultaat: opslaan in database.

Ik denk dat het probleem zit in het vernieuwen van de pagina. Ik gok dat hij de functie bij de eerste keer gewoon goed uitvoerd, maar vervolgens word de functie nog een keer opgeroepen en dus word de pagina opnieuw ingeladen tot deze het doet waardoor hij weer de eerste waardes gaat oproepen.

Ik denk dat ik stom heb gehandeld. Ik moet de header("location: index.php") vervangen door een loop waardoor hij de code blijft uitvoeren tot hij resultaat heeft. Denken jullie dat dit idd het probleem is?
 
Joren de Wit
Beheerder

Joren de Wit

09/01/2009 12:46:00
Quote Anchor link
Durf het niet te zeggen zonder je code gezien te hebben, maar het klink aannemelijk. Probeer het uit zou ik zeggen ;-)
 
Chris visser

chris visser

09/01/2009 12:54:00
Quote Anchor link
ik zal de code even neerzetten. Dan kunnen jullie meedenken als jullie zin hebben :)

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
<?php
ob_start();

$TeamID = $_GET['TeamID'];

include( 'class.knvb.php' );  
function
GetTeamStats($url, $full, $name, $club)
{

  global $mysqli;
    
## Login gegevens voor KNVB.nl
$Email         = 'test@test.com';
$Wachtwoord    = 'test';
    
## Team gegevens

## URL: link naar de statistieken van een team, zonder http://www.knvb.nl/ ervoor.
## Naam: naam van het team.
## Titel: naam van het team zoals het in het menutje weergegeven moet worden.
## Clubnaam: : naam van het team zoals weergegeven op de knvb site.

$Team = array (
  array (
  'URL'      => $url,
  'Naam'     => $full,
  'Titel'    => $name,
  'Clubnaam' => $club)          
);


if ( !isset ( $_GET [ 'team' ] ) || !isset ( $Team [ $_GET [ 'team' ] ] ) )
{
    
  $_GET [ 'team' ] = 0;
}
    
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>VVMonnickendam<?php echo $Team [ $_GET [ 'team' ] ][ 'Titel' ]; ?></title>
<style type="text/css">
body
{
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12pt;
  text-align: center;
}
a
{
  color: #000;
  text-decoration: none;
}
a:hover
{
  color: #390;
  text-decoration: underline;
}
h2
{
  margin: 15px 20px;
  font-size: 16pt;
  text-align: center;
}
table
{
  margin: 0 auto;
}
table.stand
{
  padding: 0px;
  width: 600px;
}
table.stand th, table.uitslagen th, table.programma th
{
  background: #6297DA;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size:12px;
  color:#000000;
}
table.stand th, table.stand td
{
  padding: 3px;
  border-right: #000 1px solid;
  border-bottom: #000 1px solid;
  text-align: center;
  font-family: Arial, Helvetica, sans-serif;
  font-size:12px;
  color:#000000;
}
table.uitslagen
{
  padding: 0px;
  width: 600px;
  font-family: Arial, Helvetica, sans-serif;
  font-size:12px;
  color:#000000;
}
table.programma
{
  padding: 0px;
  width: 700px;
  font-family: Arial, Helvetica, sans-serif;
  font-size:12px;
  color:#000000;
}
table.uitslagen th, table.uitslagen td, table.programma th, table.programma td
{
  padding: 3px;
  border-right: #000 1px solid;
  border-bottom: #000 1px solid;
  text-align: left;
}
</style>
</head>
<body>
    
<?php
$ripper
= new KnvbRipper ( $Email, $Wachtwoord, $Team [ $_GET [ 'team' ] ][ 'URL' ], 'programma' );

################################################
## Komende wedstrijden #########################
################################################  

?>
    
<h2>Programma</h2>
<table align="center" cellpadding="0" cellspacing="1" class="programma">
  <tr>
    <th>Datum</th>
    <th>Tijd</th>
    <th>Wedstrijd</th>
    <th>Accomodatie</th>
  </tr>
              
<?php      
$Programma
= $ripper -> rip ( );
foreach ( $Programma as $Programma )
{

  if ( eregi ( $Team [ $_GET [ 'team' ] ][ 'Naam' ], $Programma [ 'thuis_club' ] ) || eregi ( $Team [ $_GET [ 'team' ] ][ 'Naam' ], $Programma [ 'uit_club' ] ) )
  {

        echo "\t\t\t<tr style=\"background: #AAD5FF; font-weight: bold;\">\n";
  }

    else
  {          
    echo "\t\t\t<tr>\n";
        
                  
?>

    <td><?php echo $Programma [ 'datum' ]; ?></td>
    <td><?php echo $Programma [ 'tijd' ]; ?></td>
    <td><?php echo $Programma [ 'teams' ]; ?></td>
    <td><?php echo $Programma [ 'accomedatie' ]; ?></td>
  </tr>
<?php      
  }              
}

if( sizeof( $Programma ) == 0 )
{
        
  echo "  <tr>";
  echo "    <td colspan='5' style='text-align: center;'>Er is momenteel geen programma bekend!</td>";                
  echo "  </tr>";          
}

        
echo "</table>";
echo "<h2>Uitslagen</h2>";  
echo "<table cellpadding='0' cellspacing='1' class='uitslagen'>";  
echo "  <tr>";  
echo "    <th>Datum</th>";  
echo "    <th>Thuis Club</th>";  
echo "    <th>Uit Club</th>";  
echo "    <th>Uitslag</th>";  
echo "  </tr>";        


################################################
## Uitslagen van vorige week ###################
################################################  

$Uitslagen = $ripper -> rip ( 'uitslagen' );
foreach ( $Uitslagen as $Uitslag )
{

  if ( eregi ( $Team [ $_GET [ 'team' ] ][ 'Naam' ], $Uitslag [ 'thuis_club' ] ) || eregi ( $Team [ $_GET [ 'team' ] ][ 'Naam' ], $Uitslag [ 'uit_club' ] ) )
  {

        echo "\t\t\t<tr style=\"background: #eee; font-weight: bold;\">\n";
  }

    else
  {          
    echo "<tr>\n";                
    echo "  <td>".$Uitslag['datum']."</td>";
    echo "  <td>".$Uitslag['thuis_club']."</td>";
    echo "  <td>".$Uitslag['uit_club']."</td>";
    echo "  <td>".$Uitslag['uitslag']."</td>";                
    echo "</tr>";
  }          
}
        
if( sizeof( $Uitslagen ) == 0 )
{

        
  echo "<tr>";
  echo "  <td colspan='4' style='text-align: center;'>Er zijn momenteel geen uitslagen bekend!</td>";
  echo "</tr>";                        
}

        
echo "</table>";
echo "<h2>Stand</h2>";
echo "<table cellpadding='0' cellspacing='1' class='stand'>";
echo "  <tr>";
echo "    <th>#</th>";
echo "    <th style='text-align: left;'>Club</th>";
echo "    <th>G</th>";
echo "    <th>W</th>";
echo "    <th>GL</th>";
echo "    <th>V</th>";
echo "    <th>P</th>";
echo "    <th>VP</th>";
echo "    <th>DPV</th>";
echo "    <th>DPT</th>";
echo "    <th>DS</th>";
echo "    <th>PM</th>";
echo "  </tr>";      
    
        
        
################################################
## Huidige stand ###############################
################################################

$Stand = $ripper -> rip ( 'stand' );


/*
$sql = "
  INSERT INTO stand
  (
    nummer,
      club,
      gespeelt,
      gewonnen,
      gelijk,
      verloren,
      punten,
        puntverlies,
      goalsvoor,
      goalstegen,
        doelsaldo,
      puntmindering
  )  
  VALUES  
";
$t = 0;                    
$i = count($Stand);
                                
foreach($Stand as $Stand)
{
  $t++;
    #last row has , (comma)
    if($i != $t)
    {
    $sql.="('".$Stand['nummer']."', '".$Stand['club']."', '".$Stand['gespeeld']."', '".$Stand['gewonnen']."', '".$Stand['gelijk']."', '".$Stand['verloren']."', '".$Stand['punten']."', '".(( $Stand['gelijk'] * 2 ) + ( $Stand['verloren'] * 3 ))."', '".$Stand['goals_voor']."', '".$Stand['goals_tegen']."', '".( $Stand['goals_voor'] - $Stand['goals_tegen'] )."', '".$Stand['punten_mindering']."'),";
    }
    else
    {
      $sql.="('".$Stand['nummer']."', '".$Stand['club']."', '".$Stand['gespeeld']."', '".$Stand['gewonnen']."', '".$Stand['gelijk']."', '".$Stand['verloren']."', '".$Stand['punten']."', '".(( $Stand['gelijk'] * 2 ) + ( $Stand['verloren'] * 3 ))."', '".$Stand['goals_voor']."', '".$Stand['goals_tegen']."', '".( $Stand['goals_voor'] - $Stand['goals_tegen'] )."', '".$Stand['punten_mindering']."')";
  }
}
if(!$scoreresult = $mysqli->query($sql))
{
  trigger_error('Fout in query: '.$mysqli->error);
}    
else
{
  if($mysqli->affected_rows > 0)
  {
    echo "It worked !!!";
  }
}
*/


foreach ( $Stand as $Stand )
{


  if ( eregi ( $Team [ $_GET [ 'team' ] ][ 'Clubnaam' ], $Stand [ 'club' ] ) )
  {

      echo "<tr style=\"background: #cccccc; font-weight: bold;\">\n";
    echo "  <td>".$Stand[ 'nummer']."</td>";
    echo "  <td style='text-align: left;'>".$Stand['club']."</td>";
    echo "  <td>".$Stand['gespeeld']."</td>";
    echo "  <td>".$Stand['gewonnen']."</td>";
    echo "  <td>".$Stand['gelijk']."</td>";
    echo "  <td>".$Stand['verloren']."</td>";
    echo "  <td>".$Stand['punten']."</td>";
    echo "  <td>".(( $Stand['gelijk'] * 2 ) + ( $Stand['verloren'] * 3 ))."</td>";
    echo "  <td>".$Stand['goals_voor']."</td>";
    echo "  <td>".$Stand['goals_tegen']."</td>";
    echo "  <td>".( $Stand['goals_voor'] - $Stand['goals_tegen'] )."</td>";
    echo "  <td>".$Stand['punten_mindering']."</td>";          
    echo "</tr>";
  }
          
    else
  {          
    echo "<tr>\n";
    echo "  <td>".$Stand[ 'nummer']."</td>";
    echo "  <td style='text-align: left;'>".$Stand['club']."</td>";
    echo "  <td>".$Stand['gespeeld']."</td>";
    echo "  <td>".$Stand['gewonnen']."</td>";
    echo "  <td>".$Stand['gelijk']."</td>";
    echo "  <td>".$Stand['verloren']."</td>";
    echo "  <td>".$Stand['punten']."</td>";
    echo "  <td>".(( $Stand['gelijk'] * 2 ) + ( $Stand['verloren'] * 3 ))."</td>";
    echo "  <td>".$Stand['goals_voor']."</td>";
    echo "  <td>".$Stand['goals_tegen']."</td>";
    echo "  <td>".( $Stand['goals_voor'] - $Stand['goals_tegen'] )."</td>";
    echo "  <td>".$Stand['punten_mindering']."</td>";          
    echo "</tr>";
  }          
}
      


/*    
  echo "<tr>";        
  echo "  <td colspan='12' style='text-align: center;'>Er is momenteel geen stand bekend!</td> ";            
  echo "</tr>";        
*/





        
echo "  <tr>";        
echo "    <td style='border: none;' colspan='12'>";
echo "      <b>G</b>: gespeeld | <b>W</b>: gewonnen | <b>GL</b>: gelijk | <b>V</b>: verloren | <b>P</b>: punten | <b>VP</b>: verlies punten<br />";
echo "      <b>DPV</b>: doelpunten voor | <b>DPT</b>: doelpunten tegen | <b>DS</b>: doelsaldo | <b>PM</b>: punten in mindering";  
echo "    </td>";  
echo "  </tr>";      
echo "</table>";

if( sizeof( $Stand ) == 0 )
{

  header("location: index.php");  
}

?>

</body>
</html>
<?php
}

echo "<p>";
GetTeamStats(waarde1, waarde2, waarde3, waarde4);

echo "</p><p>";
GetTeamStats(waarde5, waarde6, waarde7, waarde8);
echo "</p>";
ob_end_flush();
?>
Gewijzigd op 01/01/1970 01:00:00 door chris visser
 
Dennis Mertens

Dennis Mertens

09/01/2009 12:57:00
Quote Anchor link
Goeie dag zeg.

Wil je niet meer zo'n rits code neer zetten a.u.b.? Alleen de relevante code plaatsen?

Het is erg irritant met die div (lange regels die je niet meer ziet...).

Ook zie ik dat je ob_start en ob_end_flush gebruikt. Niet doen. Zorg dat alle headers zijn 'verzonden' voordat je ook maar een spatie weergeeft.

Ook mag je, als je de html tag afsluit, niks meer weergeven.
 
Chris visser

chris visser

09/01/2009 13:02:00
Quote Anchor link
ok, van het html snap ik, maar ob_end_flush(); heb ik nodig om een header te verzenden die zegt dat ik de pagina vernieuw.

Hoe kan ik dat oplossen dan?
 
Joren de Wit
Beheerder

Joren de Wit

09/01/2009 13:12:00
Quote Anchor link
Door de logica (php) in je script gescheiden te houden van de output (html). Nu heb je alles door elkaar staan en dat gaat inderdaad problemen opleveren. Voor functies als header() mag je namelijk nog geen output naar de browser verzonden hebben.

De methode die jij nu gebruikt, het bufferen van de output, is slechts een lapmiddel om je script werken te krijgen. Het eigenlijke probleem, de verkeerde opbouw van je script, los je daar niet mee op.

Kortom, als je het goed doet, breng je daar verandering in aan. Mocht je tijdens je logica al output genereren, sla die dan tijdelijk op in een variabele en verstuur die output pas op een later moment in je script.
 
- SanThe -

- SanThe -

09/01/2009 13:17:00
Quote Anchor link
De logica is trouwens helemaal zoek. In de function open en sluit je <html> en je roept de function meerdere keren aan. Gevolg is dan ook : Html niet valid.

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
$TeamID
= $_GET['TeamID'];

include( 'class.knvb.php' );  
function
GetTeamStats($url, $full, $name, $club)
{

    // funtion inhoud
}

echo "<p>";
GetTeamStats(waarde1, waarde2, waarde3, waarde4);

echo "</p><p>";
GetTeamStats(waarde5, waarde6, waarde7, waarde8);
echo "</p>";
?>
 
Chris visser

chris visser

09/01/2009 13:27:00
Quote Anchor link
Ja klopt idd
maarja ik heb van de volledige code die ik eerst gebruikte in 1 keer een functie gemaakt. Beetje stom van me, maar ik ben nu nog aan het testen. Ik weet wel dat dit de logica is:

php uitvoer

<html>
output
</html>
 
Chris visser

chris visser

09/01/2009 13:35:00
Quote Anchor link
Ik heb de code grotendeels opgemaakt. Er kunnen nu wel wat foutjes inzitten. (volgens mij) is de logica nu wel goed. Hij werkt tenminste nu zoals ik het wil. De header(); is vervangen door een while loop en ik kan nu dmv een connectie in me DB alle teams die in de database staan oproepen met hun gegevens:

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
<?php
ob_start();

include( 'class.knvb.php' );  
function
GetTeamStats($url, $full, $name, $club)
{

  global $mysqli;

while($proceed == false)
{

    
## Login gegevens voor KNVB.nl
$Email         = 'test@test.com';
$Wachtwoord    = 'test';
    
## Team gegevens

## URL: link naar de statistieken van een team, zonder http://www.knvb.nl/ ervoor.
## Naam: naam van het team.
## Titel: naam van het team zoals het in het menutje weergegeven moet worden.
## Clubnaam: : naam van het team zoals weergegeven op de knvb site.

$Team = array (
  array (
  'URL'      => $url,
  'Naam'     => $full,
  'Titel'    => $name,
  'Clubnaam' => $club)          
);


if ( !isset ( $_GET [ 'team' ] ) || !isset ( $Team [ $_GET [ 'team' ] ] ) )
{
    
  $_GET [ 'team' ] = 0;
}
    
?>

 
    
<?php
$ripper
= new KnvbRipper ( $Email, $Wachtwoord, $Team [ $_GET [ 'team' ] ][ 'URL' ], 'programma' );

################################################
## Komende wedstrijden #########################
################################################  

$Programma = $ripper -> rip ( );  
if( sizeof( $Programma ) != 0 )
{
        
  echo "<h2>Programma</h2>";
  echo "<table align='center' cellpadding='0' cellspacing='1' class='programma'>";  
  echo "  <tr> ";
  echo "    <th>Datum</th> ";
  echo "    <th>Tijd</th> ";
  echo "    <th>Wedstrijd</th> ";
  echo "    <th>Accomodatie</th> ";
  echo "  </tr>";
                  
  foreach ( $Programma as $Programma )
  {

    if ( eregi ( $Team [ $_GET [ 'team' ] ][ 'Naam' ], $Programma [ 'thuis_club' ] ) || eregi ( $Team [ $_GET [ 'team' ] ][ 'Naam' ], $Programma [ 'uit_club' ] ) )
    {

          echo "\t\t\t<tr style=\"background: #AAD5FF; font-weight: bold;\">\n";
    }

      else
    {          
      echo "<tr>\n";                
      echo "  <td>".$Programma['datum']."</td>";
      echo "  <td>".$Programma['tijd']."</td>";
      echo "  <td>".$Programma['teams']."</td>";
      echo "  <td>".$Programma['accomedatie']."</td>";
      echo "</tr>";      
    }              
  }

    echo "</table>";
}

/*
else
{        
  echo "  <tr>";
  echo "    <td colspan='5' style='text-align: center;'>Er is momenteel geen programma bekend!</td>";                
  echo "  </tr>";          
}
*/        

################################################
## Uitslagen van vorige week ###################
################################################

$Uitslagen = $ripper -> rip ( 'uitslagen' );
if( sizeof( $Uitslagen ) != 0 )
{

  echo "<h2>Uitslagen</h2>";  
  echo "<table cellpadding='0' cellspacing='1' class='uitslagen'>";  
  echo "  <tr>";  
  echo "    <th>Datum</th>";  
  echo "    <th>Thuis Club</th>";  
  echo "    <th>Uit Club</th>";  
  echo "    <th>Uitslag</th>";  
  echo "  </tr>";          

  foreach ( $Uitslagen as $Uitslag )
  {

    if ( eregi ( $Team [ $_GET [ 'team' ] ][ 'Naam' ], $Uitslag [ 'thuis_club' ] ) || eregi ( $Team [ $_GET [ 'team' ] ][ 'Naam' ], $Uitslag [ 'uit_club' ] ) )
    {

          echo "\t\t\t<tr style=\"background: #eee; font-weight: bold;\">\n";
    }

      else
    {          
      echo "<tr>\n";                
      echo "  <td>".$Uitslag['datum']."</td>";
      echo "  <td>".$Uitslag['thuis_club']."</td>";
      echo "  <td>".$Uitslag['uit_club']."</td>";
      echo "  <td>".$Uitslag['uitslag']."</td>";                
      echo "</tr>";
    }          
  }

  echo "</table>";
}

/*        
else
{
        
  echo "<tr>";
  echo "  <td colspan='4' style='text-align: center;'>Er zijn momenteel geen uitslagen bekend!</td>";
  echo "</tr>";                        
}
*/      
################################################
## Huidige stand ###############################
################################################

$Stand = $ripper -> rip ( 'stand' );
if( sizeof( $Stand ) != 0 )
{

  echo "<h2>Stand</h2>";
  echo "<table cellpadding='0' cellspacing='1' class='stand'>";
  echo "  <tr>";
  echo "    <th>#</th>";
  echo "    <th style='text-align: left;'>Club</th>";
  echo "    <th>G</th>";
  echo "    <th>W</th>";
  echo "    <th>GL</th>";
  echo "    <th>V</th>";
  echo "    <th>P</th>";
  echo "    <th>VP</th>";
  echo "    <th>DPV</th>";
  echo "    <th>DPT</th>";
  echo "    <th>DS</th>";
  echo "    <th>PM</th>";
  echo "  </tr>";      
    


/*
$sql = "
  INSERT INTO stand
  (
    nummer,
      club,
      gespeelt,
      gewonnen,
      gelijk,
      verloren,
      punten,
        puntverlies,
      goalsvoor,
      goalstegen,
        doelsaldo,
      puntmindering
  )  
  VALUES  
";
$t = 0;                    
$i = count($Stand);
                                
foreach($Stand as $Stand)
{
  $t++;
    #last row has , (comma)
    if($i != $t)
    {
    $sql.="('".$Stand['nummer']."', '".$Stand['club']."', '".$Stand['gespeeld']."', '".$Stand['gewonnen']."', '".$Stand['gelijk']."', '".$Stand['verloren']."', '".$Stand['punten']."', '".(( $Stand['gelijk'] * 2 ) + ( $Stand['verloren'] * 3 ))."', '".$Stand['goals_voor']."', '".$Stand['goals_tegen']."', '".( $Stand['goals_voor'] - $Stand['goals_tegen'] )."', '".$Stand['punten_mindering']."'),";
    }
    else
    {
      $sql.="('".$Stand['nummer']."', '".$Stand['club']."', '".$Stand['gespeeld']."', '".$Stand['gewonnen']."', '".$Stand['gelijk']."', '".$Stand['verloren']."', '".$Stand['punten']."', '".(( $Stand['gelijk'] * 2 ) + ( $Stand['verloren'] * 3 ))."', '".$Stand['goals_voor']."', '".$Stand['goals_tegen']."', '".( $Stand['goals_voor'] - $Stand['goals_tegen'] )."', '".$Stand['punten_mindering']."')";
  }
}
if(!$scoreresult = $mysqli->query($sql))
{
  trigger_error('Fout in query: '.$mysqli->error);
}    
else
{
  if($mysqli->affected_rows > 0)
  {
    echo "It worked !!!";
  }
}
*/


  foreach ( $Stand as $Stand )
  {


    if ( eregi ( $Team [ $_GET [ 'team' ] ][ 'Clubnaam' ], $Stand [ 'club' ] ) )
    {

        echo "<tr style=\"background: #cccccc; font-weight: bold;\">\n";
      echo "  <td>".$Stand[ 'nummer']."</td>";
      echo "  <td style='text-align: left;'>".$Stand['club']."</td>";
      echo "  <td>".$Stand['gespeeld']."</td>";
      echo "  <td>".$Stand['gewonnen']."</td>";
      echo "  <td>".$Stand['gelijk']."</td>";
      echo "  <td>".$Stand['verloren']."</td>";
      echo "  <td>".$Stand['punten']."</td>";
      echo "  <td>".(( $Stand['gelijk'] * 2 ) + ( $Stand['verloren'] * 3 ))."</td>";
      echo "  <td>".$Stand['goals_voor']."</td>";
      echo "  <td>".$Stand['goals_tegen']."</td>";
      echo "  <td>".( $Stand['goals_voor'] - $Stand['goals_tegen'] )."</td>";
      echo "  <td>".$Stand['punten_mindering']."</td>";          
      echo "</tr>";
    }
          
      else
    {          
      echo "<tr>\n";
      echo "  <td>".$Stand[ 'nummer']."</td>";
      echo "  <td style='text-align: left;'>".$Stand['club']."</td>";
      echo "  <td>".$Stand['gespeeld']."</td>";
      echo "  <td>".$Stand['gewonnen']."</td>";
      echo "  <td>".$Stand['gelijk']."</td>";
      echo "  <td>".$Stand['verloren']."</td>";
      echo "  <td>".$Stand['punten']."</td>";
      echo "  <td>".(( $Stand['gelijk'] * 2 ) + ( $Stand['verloren'] * 3 ))."</td>";
      echo "  <td>".$Stand['goals_voor']."</td>";
      echo "  <td>".$Stand['goals_tegen']."</td>";
      echo "  <td>".( $Stand['goals_voor'] - $Stand['goals_tegen'] )."</td>";
      echo "  <td>".$Stand['punten_mindering']."</td>";          
      echo "</tr>";
    }          
  }

  echo "  <tr>";        
  echo "    <td style='border: none;' colspan='12'>";
  echo "      <b>G</b>: gespeeld | <b>W</b>: gewonnen | <b>GL</b>: gelijk | <b>V</b>: verloren | <b>P</b>: punten | <b>VP</b>: verlies punten<br />";
  echo "      <b>DPV</b>: doelpunten voor | <b>DPT</b>: doelpunten tegen | <b>DS</b>: doelsaldo | <b>PM</b>: punten in mindering";  
  echo "    </td>";  
  echo "  </tr>";      
  echo "</table>";    
    
    $proceed = true;      
}


  
  }
}




include("db_connect.php");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>VVMonnickendam<?php echo $Team [ $_GET [ 'team' ] ][ 'Titel' ]; ?></title>
<style type="text/css">
body
{
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12pt;
  text-align: center;
}
a
{
  color: #000;
  text-decoration: none;
}
a:hover
{
  color: #390;
  text-decoration: underline;
}
h2
{
  margin: 15px 20px;
  font-size: 16pt;
  text-align: center;
}
table
{
  margin: 0 auto;
}
table.stand
{
  padding: 0px;
  width: 600px;
}
table.stand th, table.uitslagen th, table.programma th
{
  background: #6297DA;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size:12px;
  color:#000000;
}
table.stand th, table.stand td
{
  padding: 3px;
  border-right: #000 1px solid;
  border-bottom: #000 1px solid;
  text-align: center;
  font-family: Arial, Helvetica, sans-serif;
  font-size:12px;
  color:#000000;
}
table.uitslagen
{
  padding: 0px;
  width: 600px;
  font-family: Arial, Helvetica, sans-serif;
  font-size:12px;
  color:#000000;
}
table.programma
{
  padding: 0px;
  width: 700px;
  font-family: Arial, Helvetica, sans-serif;
  font-size:12px;
  color:#000000;
}
table.uitslagen th, table.uitslagen td, table.programma th, table.programma td
{
  padding: 3px;
  border-right: #000 1px solid;
  border-bottom: #000 1px solid;
  text-align: left;
}
</style>
</head>
<body>

<?php
$sql
= "SELECT * FROM teams";
if(!$Steam = $mysqli->query($sql))
{

  trigger_error('Fout in query: '.$mysqli->error);    
}
    
else
{    
  while($team = $Steam->fetch_assoc())
  {

    GetTeamStats($team["TeamURL"], $team["TeamFull"], $team["TeamName"], $team["ClubName"]);
        echo "<hr>";
  }
}



?>

</body>
</html>


Niet Bumpen::
Twee of meer keer achter elkaar in een topic posten heet bumpen. Bumpen is pas na 24 uur toegestaan en kan een reden zijn voor de admins en moderators om een topic te sluiten. Gebruik indien nodig de http://www.phphulp.nl/imgs/forum/edit.gif knop om je tekst aan te passen.

SanThe.
Gewijzigd op 01/01/1970 01:00:00 door chris visser
 
Dennis Mertens

Dennis Mertens

09/01/2009 13:51:00
Quote Anchor link
Dennis Mertens schreef op 09.01.2009 12:57:
Goeie dag zeg.

Wil je niet meer zo'n rits code neer zetten a.u.b.? Alleen de relevante code plaatsen?

Het is erg irritant met die div (lange regels die je niet meer ziet...).
 
Chris visser

chris visser

09/01/2009 14:18:00
Quote Anchor link
Ok heb je gelijk in :)
 



Overzicht Reageren