mysql select from
maar mijn mysql_query moet gegevens halen uit die 2 tabellen is dat mogelijk?
in mijn ene tabel (cars)
staat en naam van de auto
en in mijn andere staat de auto naam als 45000 of hoger/lager
of moet ik if naam is 45000 echo autonaam ?
gr thymen
Structuur?
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
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
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
--
-- Tabel structuur voor tabel `cars`
--
CREATE TABLE IF NOT EXISTS `cars` (
`naam` varchar(16) NOT NULL DEFAULT '',
`url` varchar(255) NOT NULL DEFAULT '',
`waarde` varchar(6) NOT NULL DEFAULT '',
`auto` varchar(255) NOT NULL DEFAULT '',
FULLTEXT KEY `naam` (`naam`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Gegevens worden uitgevoerd voor tabel `cars`
--
INSERT INTO `cars` (`naam`, `url`, `waarde`, `auto`) VALUES
('45000', 'images/buick_cabrio.jpg', '45000', 'Buick Cabrio'),
('40000', 'images/aston_martin_db3s.jpg', '40000', 'Aston Martin DB3S'),
('30000', 'images/ford_fairlane.jpg', '30000', 'Ford Fairlane'),
('10000', 'images/pontiac.jpg', '10000', 'Pontiac'),
('25000', 'images/dodge_kingsway.jpg', '25000', 'Dodge Kingsway'),
('60000', 'images/chrysler_converible.jpg', '60000', 'Chrysler Converible'),
('65000', 'images/pontiac_bonneville.jpg', '65000', 'Pontiac Bonneville'),
('80000', 'images/dodge_dart.jpg', '80000', 'Dodge Dart'),
('95000', 'images/mercury_cougar.jpg', '95000', 'Mercury Cougar'),
('125000', 'images/chevy_camaro_ss.jpg', '125000', 'Chevy Camaro SS'),
('150000', 'images/ford_mustang.jpg', '150000', 'Ford Mustang'),
('15000', 'images/caddillac_sedan.jpg', '15000', 'Caddillac Sedan'),
('175000', 'images/alfa_romeo _fnm_2000_jk.jpg', '175000', 'Alfa Romeo FNM 2000 JK'),
('200000', 'images/porsche_356b_cabriolet.jpg', '200000', 'Porsche 356B Cabriolet'),
('250000', 'images/streamliner.jpg', '400000', 'Mercedes W124 Avus Streamling');
-- --------------------------------------------------------
--
-- Tabel structuur voor tabel `garage`
--
CREATE TABLE IF NOT EXISTS `garage` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`login` varchar(16) NOT NULL DEFAULT '',
`naam` varchar(16) NOT NULL DEFAULT '',
`waarde` int(6) NOT NULL DEFAULT '0',
`damage` char(3) NOT NULL DEFAULT '',
`stad` varchar(16) NOT NULL DEFAULT '',
`safe` char(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=738 ;
--
-- Gegevens worden uitgevoerd voor tabel `garage`
--
INSERT INTO `garage` (`id`, `login`, `naam`, `waarde`, `damage`, `stad`, `safe`) VALUES
(650, 'hgv', '45000', 500, '86', 'Brugge', '0'),
(651, 'Admin', '45000', 25800, '32', 'Palermo ', '0'),
(731, 'python-snake', '25000', 500, '97', 'Amsterdam', '0'),
(644, 'hgv', '250000', 500, '95', 'Brugge', '0'),
(638, 'hgv', '125000', 500, '99', 'Brugge', '0'),
(720, 'python-snake', '125000', 500, '93', 'Leuven', '0'),
(713, 'assae2', '150000', 500, '97', 'Brussel', '0'),
(707, 'lesgravity2', '80000', 500, '81', 'Brussel', '0'),
(671, 'blackgangster', '150000', 500, '86', 'Leuven', '0'),
(598, 'blackgangster', '175000', 500, '75', 'Amsterdam', '0'),
(228, 'ceroy', '40000', 5867, '64', 'Antwerpen', '0'),
(458, 'Admin', '200000', 200000, '0', 'Antwerpen', '0'),
(723, 'python-snake', '250000', 10667, '73', 'Leuven', '0'),
(714, 'python-snake', '45000', 500, '92', 'Leuven', '0'),
(601, 'blackgangster', '150000', 500, '97', 'Hasselt', '0'),
(547, 'blackgangster', '250000', 500, '82', 'Gent', '0'),
(447, 'ceroy', '175000', 175000, '0', 'Enschede', '0'),
(704, 'lesgravity2', '80000', 7467, '68', 'Brussel', '0'),
(589, 'python-snake', '10000', 2933, '53', 'Amsterdam', '0'),
(626, 'python-snake', '40000', 2667, '70', 'Amsterdam', '0'),
(504, 'hgv', '250000', 500, '84', 'Brugge', '0'),
(503, 'hgv', '10000', 500, '90', 'Brugge', '0'),
(558, 'Stickz2', '30000', 20400, '24', 'Gent', '0'),
(479, 'ceroy', '175000', 175000, '0', 'Gent', '0'),
(227, 'mr_sossa', '95000', 500, '90', 'Antwerpen', '0'),
(544, 'jurjen', '15000', 15000, '0', 'Brussel', '0'),
(369, 'ceroy', '15000', 500, '95', 'Amsterdam', '0'),
(697, 'assae2', '65000', 3467, '71', 'Leuven', '0'),
(647, 'hgv', '30000', 500, '92', 'Brugge', '0'),
(648, 'hgv', '175000', 500, '82', 'Brugge', '0'),
(716, 'python-snake', '95000', 7600, '69', 'Leuven', '0'),
(679, 'python-snake', '10000', 500, '83', 'Leuven', '0'),
(733, 'blackgangster', '25000', 22333, '8', 'Leuven', '0'),
(686, 'python-snake', '45000', 500, '92', 'Brussel', '0'),
(701, 'lesgravity2', '65000', 8667, '65', 'Brussel', '0'),
(737, 'lesgravity2', '60000', 44000, '20', 'Leuven', '0'),
(726, 'python-snake', '45000', 500, '84', 'Amsterdam', '0');
-- Tabel structuur voor tabel `cars`
--
CREATE TABLE IF NOT EXISTS `cars` (
`naam` varchar(16) NOT NULL DEFAULT '',
`url` varchar(255) NOT NULL DEFAULT '',
`waarde` varchar(6) NOT NULL DEFAULT '',
`auto` varchar(255) NOT NULL DEFAULT '',
FULLTEXT KEY `naam` (`naam`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Gegevens worden uitgevoerd voor tabel `cars`
--
INSERT INTO `cars` (`naam`, `url`, `waarde`, `auto`) VALUES
('45000', 'images/buick_cabrio.jpg', '45000', 'Buick Cabrio'),
('40000', 'images/aston_martin_db3s.jpg', '40000', 'Aston Martin DB3S'),
('30000', 'images/ford_fairlane.jpg', '30000', 'Ford Fairlane'),
('10000', 'images/pontiac.jpg', '10000', 'Pontiac'),
('25000', 'images/dodge_kingsway.jpg', '25000', 'Dodge Kingsway'),
('60000', 'images/chrysler_converible.jpg', '60000', 'Chrysler Converible'),
('65000', 'images/pontiac_bonneville.jpg', '65000', 'Pontiac Bonneville'),
('80000', 'images/dodge_dart.jpg', '80000', 'Dodge Dart'),
('95000', 'images/mercury_cougar.jpg', '95000', 'Mercury Cougar'),
('125000', 'images/chevy_camaro_ss.jpg', '125000', 'Chevy Camaro SS'),
('150000', 'images/ford_mustang.jpg', '150000', 'Ford Mustang'),
('15000', 'images/caddillac_sedan.jpg', '15000', 'Caddillac Sedan'),
('175000', 'images/alfa_romeo _fnm_2000_jk.jpg', '175000', 'Alfa Romeo FNM 2000 JK'),
('200000', 'images/porsche_356b_cabriolet.jpg', '200000', 'Porsche 356B Cabriolet'),
('250000', 'images/streamliner.jpg', '400000', 'Mercedes W124 Avus Streamling');
-- --------------------------------------------------------
--
-- Tabel structuur voor tabel `garage`
--
CREATE TABLE IF NOT EXISTS `garage` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`login` varchar(16) NOT NULL DEFAULT '',
`naam` varchar(16) NOT NULL DEFAULT '',
`waarde` int(6) NOT NULL DEFAULT '0',
`damage` char(3) NOT NULL DEFAULT '',
`stad` varchar(16) NOT NULL DEFAULT '',
`safe` char(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=738 ;
--
-- Gegevens worden uitgevoerd voor tabel `garage`
--
INSERT INTO `garage` (`id`, `login`, `naam`, `waarde`, `damage`, `stad`, `safe`) VALUES
(650, 'hgv', '45000', 500, '86', 'Brugge', '0'),
(651, 'Admin', '45000', 25800, '32', 'Palermo ', '0'),
(731, 'python-snake', '25000', 500, '97', 'Amsterdam', '0'),
(644, 'hgv', '250000', 500, '95', 'Brugge', '0'),
(638, 'hgv', '125000', 500, '99', 'Brugge', '0'),
(720, 'python-snake', '125000', 500, '93', 'Leuven', '0'),
(713, 'assae2', '150000', 500, '97', 'Brussel', '0'),
(707, 'lesgravity2', '80000', 500, '81', 'Brussel', '0'),
(671, 'blackgangster', '150000', 500, '86', 'Leuven', '0'),
(598, 'blackgangster', '175000', 500, '75', 'Amsterdam', '0'),
(228, 'ceroy', '40000', 5867, '64', 'Antwerpen', '0'),
(458, 'Admin', '200000', 200000, '0', 'Antwerpen', '0'),
(723, 'python-snake', '250000', 10667, '73', 'Leuven', '0'),
(714, 'python-snake', '45000', 500, '92', 'Leuven', '0'),
(601, 'blackgangster', '150000', 500, '97', 'Hasselt', '0'),
(547, 'blackgangster', '250000', 500, '82', 'Gent', '0'),
(447, 'ceroy', '175000', 175000, '0', 'Enschede', '0'),
(704, 'lesgravity2', '80000', 7467, '68', 'Brussel', '0'),
(589, 'python-snake', '10000', 2933, '53', 'Amsterdam', '0'),
(626, 'python-snake', '40000', 2667, '70', 'Amsterdam', '0'),
(504, 'hgv', '250000', 500, '84', 'Brugge', '0'),
(503, 'hgv', '10000', 500, '90', 'Brugge', '0'),
(558, 'Stickz2', '30000', 20400, '24', 'Gent', '0'),
(479, 'ceroy', '175000', 175000, '0', 'Gent', '0'),
(227, 'mr_sossa', '95000', 500, '90', 'Antwerpen', '0'),
(544, 'jurjen', '15000', 15000, '0', 'Brussel', '0'),
(369, 'ceroy', '15000', 500, '95', 'Amsterdam', '0'),
(697, 'assae2', '65000', 3467, '71', 'Leuven', '0'),
(647, 'hgv', '30000', 500, '92', 'Brugge', '0'),
(648, 'hgv', '175000', 500, '82', 'Brugge', '0'),
(716, 'python-snake', '95000', 7600, '69', 'Leuven', '0'),
(679, 'python-snake', '10000', 500, '83', 'Leuven', '0'),
(733, 'blackgangster', '25000', 22333, '8', 'Leuven', '0'),
(686, 'python-snake', '45000', 500, '92', 'Brussel', '0'),
(701, 'lesgravity2', '65000', 8667, '65', 'Brussel', '0'),
(737, 'lesgravity2', '60000', 44000, '20', 'Leuven', '0'),
(726, 'python-snake', '45000', 500, '84', 'Amsterdam', '0');
mijn 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
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
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
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
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
<?php
include("config.php");
if(! check_login()) {
header('Location: login.php');
exit;
}
if ($jisin == 1) {
header('Location: jisin.php');
}
$data = mysql_fetch_object(
mysql_query("
SELECT *
FROM users
WHERE login='{$_SESSION['login']}'"));
?>
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
// 1 is aan 0 is uit
?>
<html>
<head>
<title>The Sicilians</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta name="keywords" content="The Sicilians,Crimegame,Barafranca,Omerta">
<meta name="language" content="english">
<META name="description" lang="nl" content="The Sicilians">
<style>
div#bgb {
background-color: #c1bda4;
border-left: 1px solid #9c9984;
border-right: 1px solid #9c9984;
border-bottom: 1px solid #9c9984;
border-top: 1px solid #9c9984;
width: 500px;
height: auto;
}
div#menu_content {
background-color: #d1cdb5;
border: 1px solid #9c9984;
width: 500px;
height: 25px;
font-family:arial;
font-size:12px;
}
div#menu_links {
height: 26px;
float: left;
margin: 0px;
padding: 0px;
margin-left: 5px;
font-family:arial;
font-size:12px;
color: #000000;
}
a.two:link
{
color:#16130e;
text-decoration: none;
}
a.two:visited
{
color:#16130e;
text-decoration: none;
}
a.two:hover
{
color: #a4a193;
text-decoration: none;
}
div#info3 {
background-color: #c1bda4;
border-left: 1px solid #9c9984;
border-right: 1px solid #9c9984;
border-bottom: 1px solid #9c9984;
border-top: 1px solid #9c9984;
width: 500px;
height: auto;
text-align: left;
}
.maintext{
background-color: #023445;
border-left: 1px solid #FFFFFF;
border-right: 1px solid #FFFFFF;
width: 500px;
height: 25px;
font-family:arial;
font-size:12px;
color: white;
text-align: left;
padding-left:2px;
padding-top: 6px;
}
</style>
</head>
<div align="center">
<?php
if($_GET['t'] == "buick") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "45000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/buick_cabrio.jpg';
}
}
}
if($_GET['t'] == "AstonMartin") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "40000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/aston_martin_db3s.jpg';
}
}
}
if($_GET['t'] == "FordFairlane") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "30000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Ford_Fairlane.jpg';
}
}
}
if($_GET['t'] == "Pontiac") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "10000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Pontiac.jpg';
}
}
}
if($_GET['t'] == "DodgeKingsway") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "25000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Dodge_Kingsway.jpg';
}
}
}
if($_GET['t'] == "ChryslerConverible") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "60000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Chrysler_Converible.jpg';
}
}
}
if($_GET['t'] == "DodgeDart") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "45000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Dodge_Dart.jpg';
}
}
}
if($_GET['t'] == "MercuryCougar") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "45000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Mercury_Cougar.jpg';
}
}
}
if($_GET['t'] == "ChevyCamaro") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "45000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Chevy_Camaro_SS.jpg';
}
}
}
if($_GET['t'] == "FordMustang") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "45000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Ford_Mustang.jpg';
}
}
}
if($_GET['t'] == "CaddillacSedan") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "45000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Caddillac_Sedan.jpg';
}
}
}
if($_GET['t'] == "Alfa Romeo") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "45000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Alfa_Romeo_FNM_2000_JK.jpg';
}
}
}
if($_GET['t'] == "PorscheCabriolet") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "45000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Porsche_356B_Cabriolet.jpg';
}
}
}
if($_GET['t'] == "MercedesStreamling") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "45000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Mercedes_W124_Avus_Streamling.jpg';
}
}
}
$query = "
SELECT *
FROM garage
WHERE `login` = '$data->login'
ORDER BY `waarde` DESC";
$info = mysql_query($query) or die(mysql_error());
$count = 0;
while ($gegeven = mysql_fetch_array($info)) {
$auto =
mysql_fetch_object(
mysql_query("
SELECT * FROM
cars
WHERE naam='{$gegeven["naam"]}'"));
$naam = $auto->auto;
$waarde = $gegeven["waarde"];
$schade = $gegeven["damage"];
$verkoop = $gegeven["id"];
$stad = $gegeven["stad"];
$id = $gegeven["id"];
$safe = $gegeven["safe"];
$count++;
$stad = strtolower($stad);
$estad = strtolower($data->stad);
}
?>
<div id=bgb>
<table width="500" border="0">
<tr>
<th width="245" scope="row">naam</th>
<td width="245"><a href="garage.php?x=<?php echo $verkoop;?>">Verkoop </a><a href="garage.php?x=<?php echo $verkoop;?>">Crush </a><a href="garage.php?x=<?php echo $verkoop;?>">Repareer</a></td>
</tr>
<tr>
<th scope="row"><div align="left">Id:<strong><?php echo$id;?></strong><br />
Naam:<strong><?php echo$naam;?></strong><br />
Waarde: <strong><?php echo$waarde;?></strong><br />
Schade: <strong><?php echo$schade;?>%</strong><br />
Stad: <strong><?php echo$stad;?></strong></div></th>
<td><div align="left"><img src="<?php echo $imgSource ?>" alt="" width="292" height="143" /></div></td>
</tr>
</table>
</div>
include("config.php");
if(! check_login()) {
header('Location: login.php');
exit;
}
if ($jisin == 1) {
header('Location: jisin.php');
}
$data = mysql_fetch_object(
mysql_query("
SELECT *
FROM users
WHERE login='{$_SESSION['login']}'"));
?>
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
// 1 is aan 0 is uit
?>
<html>
<head>
<title>The Sicilians</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta name="keywords" content="The Sicilians,Crimegame,Barafranca,Omerta">
<meta name="language" content="english">
<META name="description" lang="nl" content="The Sicilians">
<style>
div#bgb {
background-color: #c1bda4;
border-left: 1px solid #9c9984;
border-right: 1px solid #9c9984;
border-bottom: 1px solid #9c9984;
border-top: 1px solid #9c9984;
width: 500px;
height: auto;
}
div#menu_content {
background-color: #d1cdb5;
border: 1px solid #9c9984;
width: 500px;
height: 25px;
font-family:arial;
font-size:12px;
}
div#menu_links {
height: 26px;
float: left;
margin: 0px;
padding: 0px;
margin-left: 5px;
font-family:arial;
font-size:12px;
color: #000000;
}
a.two:link
{
color:#16130e;
text-decoration: none;
}
a.two:visited
{
color:#16130e;
text-decoration: none;
}
a.two:hover
{
color: #a4a193;
text-decoration: none;
}
div#info3 {
background-color: #c1bda4;
border-left: 1px solid #9c9984;
border-right: 1px solid #9c9984;
border-bottom: 1px solid #9c9984;
border-top: 1px solid #9c9984;
width: 500px;
height: auto;
text-align: left;
}
.maintext{
background-color: #023445;
border-left: 1px solid #FFFFFF;
border-right: 1px solid #FFFFFF;
width: 500px;
height: 25px;
font-family:arial;
font-size:12px;
color: white;
text-align: left;
padding-left:2px;
padding-top: 6px;
}
</style>
</head>
<div align="center">
<?php
if($_GET['t'] == "buick") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "45000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/buick_cabrio.jpg';
}
}
}
if($_GET['t'] == "AstonMartin") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "40000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/aston_martin_db3s.jpg';
}
}
}
if($_GET['t'] == "FordFairlane") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "30000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Ford_Fairlane.jpg';
}
}
}
if($_GET['t'] == "Pontiac") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "10000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Pontiac.jpg';
}
}
}
if($_GET['t'] == "DodgeKingsway") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "25000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Dodge_Kingsway.jpg';
}
}
}
if($_GET['t'] == "ChryslerConverible") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "60000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Chrysler_Converible.jpg';
}
}
}
if($_GET['t'] == "DodgeDart") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "45000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Dodge_Dart.jpg';
}
}
}
if($_GET['t'] == "MercuryCougar") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "45000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Mercury_Cougar.jpg';
}
}
}
if($_GET['t'] == "ChevyCamaro") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "45000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Chevy_Camaro_SS.jpg';
}
}
}
if($_GET['t'] == "FordMustang") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "45000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Ford_Mustang.jpg';
}
}
}
if($_GET['t'] == "CaddillacSedan") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "45000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Caddillac_Sedan.jpg';
}
}
}
if($_GET['t'] == "Alfa Romeo") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "45000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Alfa_Romeo_FNM_2000_JK.jpg';
}
}
}
if($_GET['t'] == "PorscheCabriolet") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "45000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Porsche_356B_Cabriolet.jpg';
}
}
}
if($_GET['t'] == "MercedesStreamling") {
$sql = '
SELECT *
FROM `garage`
WHERE `login` = "'.mysql_real_escape_string($data->login).'"
AND `naam` = "45000"';
$res = mysql_query($sql);
if(!$res) {
$imgSource = 'images/notFound.jpg';
echo $sql.'<br /> gaf de volgende error<br/>' . mysql_error();
} else {
if(mysql_num_rows($res) == 0) {
$imgSource = 'images/notFound.jpg';
} else {
$row = mysql_fetch_object($res);
$imgSource = 'images/Mercedes_W124_Avus_Streamling.jpg';
}
}
}
$query = "
SELECT *
FROM garage
WHERE `login` = '$data->login'
ORDER BY `waarde` DESC";
$info = mysql_query($query) or die(mysql_error());
$count = 0;
while ($gegeven = mysql_fetch_array($info)) {
$auto =
mysql_fetch_object(
mysql_query("
SELECT * FROM
cars
WHERE naam='{$gegeven["naam"]}'"));
$naam = $auto->auto;
$waarde = $gegeven["waarde"];
$schade = $gegeven["damage"];
$verkoop = $gegeven["id"];
$stad = $gegeven["stad"];
$id = $gegeven["id"];
$safe = $gegeven["safe"];
$count++;
$stad = strtolower($stad);
$estad = strtolower($data->stad);
}
?>
<div id=bgb>
<table width="500" border="0">
<tr>
<th width="245" scope="row">naam</th>
<td width="245"><a href="garage.php?x=<?php echo $verkoop;?>">Verkoop </a><a href="garage.php?x=<?php echo $verkoop;?>">Crush </a><a href="garage.php?x=<?php echo $verkoop;?>">Repareer</a></td>
</tr>
<tr>
<th scope="row"><div align="left">Id:<strong><?php echo$id;?></strong><br />
Naam:<strong><?php echo$naam;?></strong><br />
Waarde: <strong><?php echo$waarde;?></strong><br />
Schade: <strong><?php echo$schade;?>%</strong><br />
Stad: <strong><?php echo$stad;?></strong></div></th>
<td><div align="left"><img src="<?php echo $imgSource ?>" alt="" width="292" height="143" /></div></td>
</tr>
</table>
</div>
gr thymen
Ik kan hier weinig mee.
onlogisch waarom?
SELECT * FROM cars, garage WHERE cars.naam=garage.naam
ik hoop dat je hiermee wat kunt
jaah thnx