for statement
hij laat 10 weken zien maar de eerste order komt bij week 10 te staan oftewel helemaal onderaan..
hoe kan ik dt oplossen?
alvast bedankt en nogmaals sorry voor het grote slordige script
Code (php)
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
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
<?php
include "header.php";
echo "<body bgcolor='#007208'>";
echo "<span class='tekst'>";
if(!isset($_POST['spel'])){
echo "<table width='100%' class='tekst'>";
echo "<tr valign='top'>";
echo "<td><form method='POST' action='lijst.php'><select name='product'><option value=''>Selecteer een spel</option>";
$sql = mysql_query("SELECT * FROM producten");
while($obj = mysql_fetch_array($sql)){
echo "<option value='".$obj['productid']."'>".$obj['naam']."</option>";
}
echo "</select><input type='submit' name='spel' value='Bekijk'></form>";
echo "</td>";
echo "</tr>";
echo "</table>";
}else{
echo "<table width='100%' class='tekst'>";
echo "<tr valign='top'>";
echo "<td><center>";
$sql = mysql_query("SELECT * FROM producten WHERE productid ='".$_POST['product']."'");
while($obj = mysql_fetch_array($sql)){
echo $obj['naam'];
}
echo "</center></td>";
echo "</tr>";
echo "</table>";
echo "<table width='100%' class='tekst'>";
echo "<tr valign='top'>";
echo "<td>Week</td><td>Naam</td><td>Status</td>";
echo "</tr>";
$sql2 = mysql_query("SELECT * FROM orders WHERE productid ='".$_POST['product']."' AND status != '5'");
if(mysql_num_rows($sql2) < 1){
echo "<td>Niemand heeft dit spel besteld, u kunt de eerste zijn</td><tr></table>";
}else{
while($obj2 = mysql_fetch_array($sql2)){
for($week =1; $week <= 10; $week += 1){
echo "<tr valign='top'>";
echo "<td>".$week."</td>";
}
$sql3 = mysql_query("SELECT * FROM klanten WHERE klantid= '".$obj2['klantid']."'");
while($obj3 = mysql_fetch_array($sql3)){
echo "<td>".$obj3['voornaam']." ".$obj3['achternaam']."</td>";
echo "<td>".$obj2['status']."</td>";
echo "</tr>";
}
echo "</table>";
}
}
}
echo "</span>";
echo "</body>";
?>
include "header.php";
echo "<body bgcolor='#007208'>";
echo "<span class='tekst'>";
if(!isset($_POST['spel'])){
echo "<table width='100%' class='tekst'>";
echo "<tr valign='top'>";
echo "<td><form method='POST' action='lijst.php'><select name='product'><option value=''>Selecteer een spel</option>";
$sql = mysql_query("SELECT * FROM producten");
while($obj = mysql_fetch_array($sql)){
echo "<option value='".$obj['productid']."'>".$obj['naam']."</option>";
}
echo "</select><input type='submit' name='spel' value='Bekijk'></form>";
echo "</td>";
echo "</tr>";
echo "</table>";
}else{
echo "<table width='100%' class='tekst'>";
echo "<tr valign='top'>";
echo "<td><center>";
$sql = mysql_query("SELECT * FROM producten WHERE productid ='".$_POST['product']."'");
while($obj = mysql_fetch_array($sql)){
echo $obj['naam'];
}
echo "</center></td>";
echo "</tr>";
echo "</table>";
echo "<table width='100%' class='tekst'>";
echo "<tr valign='top'>";
echo "<td>Week</td><td>Naam</td><td>Status</td>";
echo "</tr>";
$sql2 = mysql_query("SELECT * FROM orders WHERE productid ='".$_POST['product']."' AND status != '5'");
if(mysql_num_rows($sql2) < 1){
echo "<td>Niemand heeft dit spel besteld, u kunt de eerste zijn</td><tr></table>";
}else{
while($obj2 = mysql_fetch_array($sql2)){
for($week =1; $week <= 10; $week += 1){
echo "<tr valign='top'>";
echo "<td>".$week."</td>";
}
$sql3 = mysql_query("SELECT * FROM klanten WHERE klantid= '".$obj2['klantid']."'");
while($obj3 = mysql_fetch_array($sql3)){
echo "<td>".$obj3['voornaam']." ".$obj3['achternaam']."</td>";
echo "<td>".$obj2['status']."</td>";
echo "</tr>";
}
echo "</table>";
}
}
}
echo "</span>";
echo "</body>";
?>
SELECT .... ..... ..... ... ORDER BY ..... ASC (of DESC)
maakt niet uit hij blijft onderaan staan..
is er nog iemand die mij hiermee kan helpen?
Als ik het script begrijp staat er nu
1-10 en daarna (zelfe regel!) de orders. Op de zelfde regel, hieronder meer uitleg
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?PHP
// (...)
while($obj2 = mysql_fetch_array($sql2)){
for($week =1; $week <= 10; $week += 1){
echo "<tr valign='top'>";
echo "<td>".$week."</td>";
} // Hier staat dus 1,2,3,4,5,6,7,8,9,10 en daar na -> dit hieronder dus voornaam - achternaam ,status
$sql3 = mysql_query("SELECT * FROM klanten WHERE klantid= '".$obj2['klantid']."'");
while($obj3 = mysql_fetch_array($sql3)){
echo "<td>".$obj3['voornaam']." ".$obj3['achternaam']."</td>";
echo "<td>".$obj2['status']."</td>";
echo "</tr>"; // Hier wordt pas de regel gelsloten
}
// En nog een opmerking Check je input dus niet zomaar $_POST maar dit doet er niet toe.
// (...)
[/code]
Dus ik denk dat je nog even goed je script moet doorlezen en kijken of de opbouw klopt
// (...)
while($obj2 = mysql_fetch_array($sql2)){
for($week =1; $week <= 10; $week += 1){
echo "<tr valign='top'>";
echo "<td>".$week."</td>";
} // Hier staat dus 1,2,3,4,5,6,7,8,9,10 en daar na -> dit hieronder dus voornaam - achternaam ,status
$sql3 = mysql_query("SELECT * FROM klanten WHERE klantid= '".$obj2['klantid']."'");
while($obj3 = mysql_fetch_array($sql3)){
echo "<td>".$obj3['voornaam']." ".$obj3['achternaam']."</td>";
echo "<td>".$obj2['status']."</td>";
echo "</tr>"; // Hier wordt pas de regel gelsloten
}
// En nog een opmerking Check je input dus niet zomaar $_POST maar dit doet er niet toe.
// (...)
[/code]
Dus ik denk dat je nog even goed je script moet doorlezen en kijken of de opbouw klopt
Gewijzigd op 01/01/1970 01:00:00 door Han eev
week
1
2
3
4
5
..10 hier komt de record te staan terwijl hij bij 1 hoort te komen te staan..
al er meerdere records komen komt dat er zo te staan
12345678910endanderecordzo...
oftewel het is helemaal fout gegaan... kan iemand dit script nog redden? :P
en hoe ik het wil is 1 tot en met 10 onder elkaar
en daarnaast dan gewoon de orders van 1 tot en met 10
zou iemand me willen helpen om dit te maken? ik kom er echt niet uit
wat ik altijd doe als ik er niet uit kom, het gewoon helemaal overnieuw scripten goed veel ruimte voor alles nemen en er bij vermerlden wat het precies doet, vaak werkt het dan alwel maar doet het script het dan nog niet dan is het in iedergeval makelijker te lezen