heb al wat gezocht maar het wil nog steeds niet werken.
Ben nu al zo'n 2 uur bezig met 1 querie maar hij wil niet echt
hij zou nu alleen planet moeten laten zien die hoger dan 20 iron hebben maar hij laat ook nog planets zien die bv 16 oct hebben of helemaal niets aan bonus.
hier een stukje uit de output
wat gaat er fout bij de querie?
Ben nu al zo'n 2 uur bezig met 1 querie maar hij wil niet echt
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
56
57
58
59
60
| <? $xbegin = 61; $xeinde = 120; $ybegin = 0; $yeinde = 61; $food = ''; $iron = 20; $oct = ''; $end = ''; $insert_food = ''; $insert_iron = ''; $insert_oct = ''; $insert_end = ''; if($food != '') { $insert_food = "AND planets.planet_food >= $food"; } if($iron != '') { if($food != '') { $insert_iron = "AND planets.planet_iron >= $iron"; } else { $insert_iron = "OR planets.planet_iron >= $iron"; } } if($oct != '') { if($food != '' && $iron != '') { $insert_oct = "AND planets.planet_octarine >= $oct"; } else { $insert_oct = "OR planets.planet_octarine >= $oct"; } } if($end != '') { if($food != '' && $iron != '' && $oct != '') { $insert_end = "AND planets.planet_endurium >= $end"; } else { $insert_end = "OR planets.planet_endurium >= $end"; } } $q = mysql_query("SELECT planets.system_id, planets.planet_nr, planets.planet_food, planets.planet_iron, planets.planet_octarine, planets.planet_endurium FROM systems, planets WHERE systems.system_id = planets.system_id AND systems.x >= '$xbegin' AND systems.x <= '$xeinde' AND systems.y >= '$ybegin' AND systems.y <= '$yeinde' ".$insert_food." ".$insert_iron." ".$insert_oct." ".$insert_end." GROUP BY planets.system_id")or die (mysql_error()); ?> |
hij zou nu alleen planet moeten laten zien die hoger dan 20 iron hebben maar hij laat ook nog planets zien die bv 16 oct hebben of helemaal niets aan bonus.
hier een stukje uit de output
code:
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
| <HTML>
<HEAD>
<TITLE>Overview planets</TITLE>
</HEAD>
</BODY>
<TABLE BORDER = '1'>
<TR>
<TD>Planet_nr.</TD>
<TD>food</TD>
<TD>iron</TD>
<TD>octarine</TD>
<TD>endurium</TD>
</TR>
<TR>
<TD>1,22:7</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center">22</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
</TR>
<TR>
<TD>1,24:6</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center">21</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
</TR>
<TR>
<TD>1,40:3</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center">24</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
</TR>
<TR>
<TD>1,93:13</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center">22</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
</TR>
<TR>
<TD>1,98:4</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center">25</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
</TR>
<TR>
<TD>10,115:14</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center">20</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
</TR>
<TR>
<TD>10,35:19</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center">22</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
</TR>
<TR>
<TD>10,63:13</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center">23</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
</TR>
<TR>
<TD>10,65:11</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center">20</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
</TR>
<TR>
<TD>10,70:8</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center">21</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
</TR>
<TR>
<TD>10,74:18</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center">22</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
</TR>
<TR>
<TD>10,80:18</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center">20</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
</TR>
<TR>
<TD>100,115:3</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center">23</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
</TR>
<TR>
<TD>100,117:12</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center">21</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
</TR>
<TR>
<TD>100,14:1</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
</TR>
<TR>
<TD>100,16:1</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
</TR>
<TR>
<TD>100,25:1</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center">22</TD>
</TR>
<TR>
<TD>100,28:1</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
</TR>
<TR>
<TD>100,36:1</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
</TR>
<TR>
<TD>100,39:1</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center">20</TD>
</TR>
<TR>
<TD>100,4:1</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center">12</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
</TR>
<TR>
<TD>100,43:1</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
</TR>
<TR>
<TD>100,47:1</TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center"></TD>
<TD ALIGN="center">16</TD>
<TD ALIGN="center"></TD>
</TR>
</TABLE>
</BODY>
</HTML> |
wat gaat er fout bij de querie?
[ Voor 36% gewijzigd door InfoTracer op 30-10-2005 15:49 ]