Probleem met PHP script
En ik heb nu alweer een probleem.. normaal laat ik het erbij zitten maar nu wil ik graag verder. Ik werk namelijk aan een Criminals.
Het Probleem: Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /usr/export/www/hosting/sevion/crimegame/travel.php on line 41
Dat soort warnings krijg ik op somige plekken op de site.
Ik weet dat ik iets moet aanpassen op de site maar ik weet niet hoe.. hieronder het script..
------------------------------------------------
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php /* ------------------------- */
$UPDATE_DB = 1;
include("_include-config.php");
include("ban.php");
if(! check_login()) {
header("Location: login.php");
exit;
}
include("_include-game.php");
mysql_query("UPDATE `[users]` SET `online`=NOW() WHERE `login`='{$data->login}'");
/* ------------------------- */ ?>
$UPDATE_DB = 1;
include("_include-config.php");
include("ban.php");
if(! check_login()) {
header("Location: login.php");
exit;
}
include("_include-game.php");
mysql_query("UPDATE `[users]` SET `online`=NOW() WHERE `login`='{$data->login}'");
/* ------------------------- */ ?>
<br><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Crimegame</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<body background="images/xtremewar_33.jpg" text="#FFFFFF" link="#999999" vlink="#999999" alink="#999999" topmargin="0">
<link href="style2.css" rel="stylesheet" type="text/css">
<base target="I1" />
</head>
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
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
<?
$gn1 = mysql_query("SELECT *,UNIX_TIMESTAMP(`gevangenis`) AS `gevangenis`,0 FROM `[users]` WHERE `login`='{$_SESSION['login']}'");
$gn = mysql_fetch_object($gn1); if($gn->gevangenis + $gn->gevangenistijd > time()){
$verschil1 = ($gn->gevangenis+$gn->gevangenistijd) - time() - 3600;
$verschil = date("H:i:s", "$verschil1");print <<<ENDHTML
<center><b>Je zit in de gevangenis</b><br><br>
<b>Je word over $verschil seconden vrijgelaten</b>
ENDHTML;
}
else{
$gn1 = mysql_query("SELECT *,UNIX_TIMESTAMP(`vliegen`) AS `vliegen`,0 FROM `[users]` WHERE `login`='{$_SESSION['login']}'");
$gn = mysql_fetch_object($gn1); if($gn->vliegen + $gn->vliegentime > time()){
$verschil = $gn->vliegen + $gn->vliegentime - time() - 3600;
$verschil = date("H:i:s", "$verschil1");
print <<<ENDHTML
<tr><td class="tabel_standaard2" align="center">
<p><font size="5"><b>Wachten</b></font></p>
<p> </p>
<p><font size="5"><b>Je mag maar om het half uur reizen! Je moet nog $verschil Minuten wachten voordat je weer kan reizen naar een ander land!</b></font></p></td></tr>
ENDHTML;
}
else{
$select = mysql_query("SELECT * FROM `[buildings]` WHERE `type`='trainstation' AND `city`='{$data->land}'");
$aantal = mysql_fetch_object($select);
if($_GET['trein'] == 'koop') {
if($aantal->owner == '' && $data->trein == '1') {
$maximum = $_POST['maximum'];
if($_POST['code']) {
$code = $_POST['code'];
$aftrek = '50000';
if($data->cash >= $aftrek && $code == TRUE && $maximum > 1000 && $maximum < 10000) {
mysql_query("UPDATE `[users]` SET `cash`=`cash`-'$aftrek',`trein`+'1' WHERE `login`='$data->login'");
mysql_query("UPDATE `[buildings]` SET `owner`='$data->login',`price`='$maximum',`code`='$code' WHERE `city`='$data->land'");
echo "U heeft de Trein Station gekocht in $land<br>";
echo "<script language=\"javascript\">setTimeout('window.location=\"travel.php\"',2000)</script>";
}
else {
echo "U heeft niet genoeg geld los! Of uw Reis prijs ligt niet tussen de 1000 en de 10000!";
}
}
else {
echo "<form method=POST>
Geef een code op (Vul gewoon wat in): <input name=code maxlength=2 size=4><br>
Geef een Reis prijs op: <input name=maximum maxlength=4 size=4><br>
<input type=submit value=Opslaan></form>";
}
}else{ echo "U kan deze niet kopen";
}}
$land1 = Array("","Nederland","Groenland","De Verenigde Staten","Brazilië","Argentinië","Afrika","Australië","China","Rusland","");
$land = $land1[$_POST['land2']];
if (isset($_POST['submit2'])){
$land3 = $_POST['land2'];
if ($land3 == "1" OR $land3 == "2" OR $land3 == "3" OR $land3 == "4" OR $land3 == "5" OR $land3 == "6" OR $land3 == "7" OR $land3 == "8" OR $land3 == "9"){
if ($land3 == "10" AND $data->level <= 50) {
echo "ongeldige locatie";
} else {
$price = "$aantal->price";
if ($data->cash >= $price){
mysql_query("UPDATE `[users]` SET `cash`=`cash`+'{$price}' WHERE `login`='{$aantal->owner}'");
mysql_query("UPDATE `[buildings]` SET `profit`=`profit`+'{$price}' WHERE `type`='trainstation' AND `city`='{$data->land}'");
mysql_query("UPDATE `[users]` SET `cash`=`cash`-'{$price}',`land`='{$land3}',`vliegen`=NOW(),`vliegentime`='1800' WHERE `login`='{$data->login}'");
mysql_query("INSERT INTO `[logs]`(login,IP,code,area,time) values('$login','$IP','{$price}','Travel',NOW())");
print <<<ENDHTML
<center><font size="5">Welkom in {$land}!</font></center>
ENDHTML;
exit;
}
else {
print <<<ENDHTML
<table width=100%>
<tr>
<td align="center" class="MainTxt"><font color=red>
je hebt niet genoeg geld contant staan
</td>
</tr>
</table>
ENDHTML;
}
}
} else {
echo "Ongeldig land";
}
}
$land1 = Array("","Nederland","Groenland","De Verenigde Staten","Brazilië","Argentinië","Afrika","Australië","China","Rusland","");
$land = $land1[$data->land];
$dbres = mysql_query("SELECT * FROM `[logs]` WHERE UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(`time`) < 1800 AND `login`='{$data->login}' AND `area`='Travel'");
if(mysql_num_rows($dbres) != 0) {
print <<<ENDHTML
<table align=center width=300>
<tr><td class=subTitle><b>Reizen</b></td></tr>
<tr><td class=mainTxt>
<center>Je kunt elke 30 minuten reizen</font>
</center>
</td></tr>
</table>
ENDHTML;
} elseif($aantal->owner == '') {
print <<<ENDHTML
<table align=center width=300>
<tr><td class=subTitle><b>Reizen</b></td></tr>
<tr><td class=mainTxt>
<center>Je kunt niet reizen op een treinstaion zonder eigenaar</font><br>
<a href="travel.php?trein=koop"><font size=4>Neem het over!</font></a>
</center>
</td></tr>
</table>
ENDHTML;
} else {
$select = mysql_query("SELECT * FROM `[buildings]` WHERE `type`='trainstation' AND `city`='{$data->land}'");
$aantal = mysql_fetch_object($select);
$owner = ($aantal->owner == "unowned") ? "<b><a href=\"take.php?t=trainstation&c=$data->land\">Unowned</a></b>" : "<a href=\"profile.php?x={$aantal->owner}\">$aantal->owner</a>";
print <<<ENDHTML
<form action="" method="post" name="land1">
<center><table width=240 border=1 bordercolor=black cellspacing=0 cellpadding=2>
<tr>
<table align=center width=300>
<tr><td class=subTitle>Trein Station in: <b>{$land}</b> (Eigenaar: <b>{$owner}</b>)</td></tr>
<tr><td class=mainTxt>
</tr>
<tr>
<td colspan=2 align=center class="mainTxt">De Reis prijs is: €{$aantal->price},-</td>
</tr>
<tr>
<td colspan=2 align=center class="mainTxt"><img src="images/treinstation.jpg"></td>
</tr>
ENDHTML;
if($data->land != 1) {
echo " <tr>
<td class=\"mainTxt\"><input type=radio class=\"normalRadio\" value=\"1\" name=\"land2\" id=\"1\"><LABEL id=\"a1\" for=\"1\">Nederland</LABEL></td>
</tr>";
}
if($data->land != 2) {
echo " <tr>
<td class=\"mainTxt\"><input type=radio class=\"normalRadio\" value=\"2\" name=\"land2\" id=\"2\"><LABEL id=\"a2\" for=\"2\">Groenland</LABEL></td>
</tr>";
}
if($data->land != "3") {
echo " <tr>
<td class=\"mainTxt\"><input type=radio class=\"normalRadio\" value=\"3\" name=\"land2\" id=\"3\"><LABEL id=\"a3\" for=\"3\">Verenigde Staten</LABEL></td>
</tr>";
}
if($data->land != 4) {
echo " <tr>
<td class=\"mainTxt\"><input type=radio class=\"normalRadio\" value=\"4\" name=\"land2\" id=\"4\"><LABEL id=\"a4\" for=\"4\">Brazilië</LABEL></td>
</tr>";
}
if($data->land != 5) {
echo " <tr>
<td class=\"mainTxt\"><input type=radio class=\"normalRadio\" value=\"5\" name=\"land2\" id=\"5\"><LABEL id=\"a5\" for=\"5\">Argentinië</LABEL></td>
</tr>";
}
if($data->land != 6) {
echo " <tr>
<td class=\"mainTxt\"><input type=radio class=\"normalRadio\" value=\"6\" name=\"land2\" id=\"6\"><LABEL id=\"a6\" for=\"6\">Afrika</LABEL></td>
</tr>";
}
if($data->land != 7) {
echo " <tr>
<td class=\"mainTxt\"><input type=radio class=\"normalRadio\" value=\"7\" name=\"land2\" id=\"7\"><LABEL id=\"a7\" for=\"7\">Australië</LABEL></td>
</tr>";
}
if($data->land != 8) {
echo " <tr>
<td class=\"mainTxt\"><input type=radio class=\"normalRadio\" value=\"8\" name=\"land2\" id=\"8\"><LABEL id=\"a8\" for=\"8\">China</LABEL></td>
</tr>";
}
if($data->land != "9") {
echo " <tr>
<td class=\"mainTxt\"><input type=radio class=\"normalRadio\" value=\"9\" name=\"land2\" id=\"9\"><LABEL id=\"a9\" for=\"9\">Rusland</LABEL></td>
</tr>";
}
print <<<ENDHTML
<tr>
<td colspan=2 align=center class="mainTxt">
<input type="submit" name="submit2" value="Reis!"></td>
</tr>
</table>
<br>
</center>
</form>
ENDHTML;
}
$select = mysql_query("SELECT * FROM `[buildings]` WHERE `type`='trainstation' AND `city`='{$data->land}'");
$aantal = mysql_fetch_object($select);
if ($data->login == $aantal->owner){
print <<<ENDHTML
<table align=center width=300>
<tr><td class=subTitle><b>Reizen</b></td></tr>
<tr><td class=mainTxt>
<center>
<form method="POST" action="">
<center>De winst bedraagt: {$aantal->profit}.<br>
je kunt het treinstaion altijd wegdoen, dan heeft het geen owner meer<br></center>
<input type="submit" name="drop" value="Doe het treinstation weg!"><br>
<center>Je kunt hem ook altijd weggeven.<br>
<input type="text" name="newowner" width="40"><input type="submit" name="giveto" value="geef!">
</form></font>
</center>
</td></tr>
</table></center>
ENDHTML;
if (isset($_POST['drop']) && $data->login == $aantal->owner){
mysql_query("UPDATE `[buildings]` SET `owner`='' WHERE `type`='trainstation' AND `city`='{$data->land}'");
mysql_query("UPDATE `[users]` SET `trein`='0' WHERE `login`='$data->login'");
mysql_query("INSERT INTO `[logs]`(login,IP,code,area,time) values('$login','$IP','0','Drop trainstation',NOW())");
echo "<center><table width=90%><tr><td class=\"mainTxt\">Je hebt de treinstation weggedaan!</td></tr></table></center>";
}
ENDHTML;
if (isset($_POST['giveto']) && $data->login == $aantal->owner){
$dbres = mysql_query("SELECT `login` FROM `[users]` WHERE `login`='$newowner'");
$logincheck = mysql_num_rows($dbres);
$new = mysql_fetch_object($dbres);
if ($logincheck >= 1){
$newowner = $_POST['newowner'];
mysql_query("UPDATE `[buildings]` SET `owner`='$new->login' WHERE `type`='trainstation' AND `city`='{$data->land}'");
mysql_query("UPDATE `[users]` SET `trein`='1' WHERE `login`='$new->login'");
mysql_query("INSERT INTO `[logs]`(login,IP,code,area,time) values('$login','$IP','0','Give trainstation',NOW())");
echo "<center><table width=90%><tr><td class=\"mainTxt\">Je hebt de treinstation aan $new->login! gegeven</td></tr></table></center>";
}
else
echo "<center><table width=90%><tr><td class=\"mainTxt\"><font color=red>Die naam bestaat niet</td></tr></table></center>";
}
ENDHTML;
}
}
}
?>
$gn1 = mysql_query("SELECT *,UNIX_TIMESTAMP(`gevangenis`) AS `gevangenis`,0 FROM `[users]` WHERE `login`='{$_SESSION['login']}'");
$gn = mysql_fetch_object($gn1); if($gn->gevangenis + $gn->gevangenistijd > time()){
$verschil1 = ($gn->gevangenis+$gn->gevangenistijd) - time() - 3600;
$verschil = date("H:i:s", "$verschil1");print <<<ENDHTML
<center><b>Je zit in de gevangenis</b><br><br>
<b>Je word over $verschil seconden vrijgelaten</b>
ENDHTML;
}
else{
$gn1 = mysql_query("SELECT *,UNIX_TIMESTAMP(`vliegen`) AS `vliegen`,0 FROM `[users]` WHERE `login`='{$_SESSION['login']}'");
$gn = mysql_fetch_object($gn1); if($gn->vliegen + $gn->vliegentime > time()){
$verschil = $gn->vliegen + $gn->vliegentime - time() - 3600;
$verschil = date("H:i:s", "$verschil1");
print <<<ENDHTML
<tr><td class="tabel_standaard2" align="center">
<p><font size="5"><b>Wachten</b></font></p>
<p> </p>
<p><font size="5"><b>Je mag maar om het half uur reizen! Je moet nog $verschil Minuten wachten voordat je weer kan reizen naar een ander land!</b></font></p></td></tr>
ENDHTML;
}
else{
$select = mysql_query("SELECT * FROM `[buildings]` WHERE `type`='trainstation' AND `city`='{$data->land}'");
$aantal = mysql_fetch_object($select);
if($_GET['trein'] == 'koop') {
if($aantal->owner == '' && $data->trein == '1') {
$maximum = $_POST['maximum'];
if($_POST['code']) {
$code = $_POST['code'];
$aftrek = '50000';
if($data->cash >= $aftrek && $code == TRUE && $maximum > 1000 && $maximum < 10000) {
mysql_query("UPDATE `[users]` SET `cash`=`cash`-'$aftrek',`trein`+'1' WHERE `login`='$data->login'");
mysql_query("UPDATE `[buildings]` SET `owner`='$data->login',`price`='$maximum',`code`='$code' WHERE `city`='$data->land'");
echo "U heeft de Trein Station gekocht in $land<br>";
echo "<script language=\"javascript\">setTimeout('window.location=\"travel.php\"',2000)</script>";
}
else {
echo "U heeft niet genoeg geld los! Of uw Reis prijs ligt niet tussen de 1000 en de 10000!";
}
}
else {
echo "<form method=POST>
Geef een code op (Vul gewoon wat in): <input name=code maxlength=2 size=4><br>
Geef een Reis prijs op: <input name=maximum maxlength=4 size=4><br>
<input type=submit value=Opslaan></form>";
}
}else{ echo "U kan deze niet kopen";
}}
$land1 = Array("","Nederland","Groenland","De Verenigde Staten","Brazilië","Argentinië","Afrika","Australië","China","Rusland","");
$land = $land1[$_POST['land2']];
if (isset($_POST['submit2'])){
$land3 = $_POST['land2'];
if ($land3 == "1" OR $land3 == "2" OR $land3 == "3" OR $land3 == "4" OR $land3 == "5" OR $land3 == "6" OR $land3 == "7" OR $land3 == "8" OR $land3 == "9"){
if ($land3 == "10" AND $data->level <= 50) {
echo "ongeldige locatie";
} else {
$price = "$aantal->price";
if ($data->cash >= $price){
mysql_query("UPDATE `[users]` SET `cash`=`cash`+'{$price}' WHERE `login`='{$aantal->owner}'");
mysql_query("UPDATE `[buildings]` SET `profit`=`profit`+'{$price}' WHERE `type`='trainstation' AND `city`='{$data->land}'");
mysql_query("UPDATE `[users]` SET `cash`=`cash`-'{$price}',`land`='{$land3}',`vliegen`=NOW(),`vliegentime`='1800' WHERE `login`='{$data->login}'");
mysql_query("INSERT INTO `[logs]`(login,IP,code,area,time) values('$login','$IP','{$price}','Travel',NOW())");
print <<<ENDHTML
<center><font size="5">Welkom in {$land}!</font></center>
ENDHTML;
exit;
}
else {
print <<<ENDHTML
<table width=100%>
<tr>
<td align="center" class="MainTxt"><font color=red>
je hebt niet genoeg geld contant staan
</td>
</tr>
</table>
ENDHTML;
}
}
} else {
echo "Ongeldig land";
}
}
$land1 = Array("","Nederland","Groenland","De Verenigde Staten","Brazilië","Argentinië","Afrika","Australië","China","Rusland","");
$land = $land1[$data->land];
$dbres = mysql_query("SELECT * FROM `[logs]` WHERE UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(`time`) < 1800 AND `login`='{$data->login}' AND `area`='Travel'");
if(mysql_num_rows($dbres) != 0) {
print <<<ENDHTML
<table align=center width=300>
<tr><td class=subTitle><b>Reizen</b></td></tr>
<tr><td class=mainTxt>
<center>Je kunt elke 30 minuten reizen</font>
</center>
</td></tr>
</table>
ENDHTML;
} elseif($aantal->owner == '') {
print <<<ENDHTML
<table align=center width=300>
<tr><td class=subTitle><b>Reizen</b></td></tr>
<tr><td class=mainTxt>
<center>Je kunt niet reizen op een treinstaion zonder eigenaar</font><br>
<a href="travel.php?trein=koop"><font size=4>Neem het over!</font></a>
</center>
</td></tr>
</table>
ENDHTML;
} else {
$select = mysql_query("SELECT * FROM `[buildings]` WHERE `type`='trainstation' AND `city`='{$data->land}'");
$aantal = mysql_fetch_object($select);
$owner = ($aantal->owner == "unowned") ? "<b><a href=\"take.php?t=trainstation&c=$data->land\">Unowned</a></b>" : "<a href=\"profile.php?x={$aantal->owner}\">$aantal->owner</a>";
print <<<ENDHTML
<form action="" method="post" name="land1">
<center><table width=240 border=1 bordercolor=black cellspacing=0 cellpadding=2>
<tr>
<table align=center width=300>
<tr><td class=subTitle>Trein Station in: <b>{$land}</b> (Eigenaar: <b>{$owner}</b>)</td></tr>
<tr><td class=mainTxt>
</tr>
<tr>
<td colspan=2 align=center class="mainTxt">De Reis prijs is: €{$aantal->price},-</td>
</tr>
<tr>
<td colspan=2 align=center class="mainTxt"><img src="images/treinstation.jpg"></td>
</tr>
ENDHTML;
if($data->land != 1) {
echo " <tr>
<td class=\"mainTxt\"><input type=radio class=\"normalRadio\" value=\"1\" name=\"land2\" id=\"1\"><LABEL id=\"a1\" for=\"1\">Nederland</LABEL></td>
</tr>";
}
if($data->land != 2) {
echo " <tr>
<td class=\"mainTxt\"><input type=radio class=\"normalRadio\" value=\"2\" name=\"land2\" id=\"2\"><LABEL id=\"a2\" for=\"2\">Groenland</LABEL></td>
</tr>";
}
if($data->land != "3") {
echo " <tr>
<td class=\"mainTxt\"><input type=radio class=\"normalRadio\" value=\"3\" name=\"land2\" id=\"3\"><LABEL id=\"a3\" for=\"3\">Verenigde Staten</LABEL></td>
</tr>";
}
if($data->land != 4) {
echo " <tr>
<td class=\"mainTxt\"><input type=radio class=\"normalRadio\" value=\"4\" name=\"land2\" id=\"4\"><LABEL id=\"a4\" for=\"4\">Brazilië</LABEL></td>
</tr>";
}
if($data->land != 5) {
echo " <tr>
<td class=\"mainTxt\"><input type=radio class=\"normalRadio\" value=\"5\" name=\"land2\" id=\"5\"><LABEL id=\"a5\" for=\"5\">Argentinië</LABEL></td>
</tr>";
}
if($data->land != 6) {
echo " <tr>
<td class=\"mainTxt\"><input type=radio class=\"normalRadio\" value=\"6\" name=\"land2\" id=\"6\"><LABEL id=\"a6\" for=\"6\">Afrika</LABEL></td>
</tr>";
}
if($data->land != 7) {
echo " <tr>
<td class=\"mainTxt\"><input type=radio class=\"normalRadio\" value=\"7\" name=\"land2\" id=\"7\"><LABEL id=\"a7\" for=\"7\">Australië</LABEL></td>
</tr>";
}
if($data->land != 8) {
echo " <tr>
<td class=\"mainTxt\"><input type=radio class=\"normalRadio\" value=\"8\" name=\"land2\" id=\"8\"><LABEL id=\"a8\" for=\"8\">China</LABEL></td>
</tr>";
}
if($data->land != "9") {
echo " <tr>
<td class=\"mainTxt\"><input type=radio class=\"normalRadio\" value=\"9\" name=\"land2\" id=\"9\"><LABEL id=\"a9\" for=\"9\">Rusland</LABEL></td>
</tr>";
}
print <<<ENDHTML
<tr>
<td colspan=2 align=center class="mainTxt">
<input type="submit" name="submit2" value="Reis!"></td>
</tr>
</table>
<br>
</center>
</form>
ENDHTML;
}
$select = mysql_query("SELECT * FROM `[buildings]` WHERE `type`='trainstation' AND `city`='{$data->land}'");
$aantal = mysql_fetch_object($select);
if ($data->login == $aantal->owner){
print <<<ENDHTML
<table align=center width=300>
<tr><td class=subTitle><b>Reizen</b></td></tr>
<tr><td class=mainTxt>
<center>
<form method="POST" action="">
<center>De winst bedraagt: {$aantal->profit}.<br>
je kunt het treinstaion altijd wegdoen, dan heeft het geen owner meer<br></center>
<input type="submit" name="drop" value="Doe het treinstation weg!"><br>
<center>Je kunt hem ook altijd weggeven.<br>
<input type="text" name="newowner" width="40"><input type="submit" name="giveto" value="geef!">
</form></font>
</center>
</td></tr>
</table></center>
ENDHTML;
if (isset($_POST['drop']) && $data->login == $aantal->owner){
mysql_query("UPDATE `[buildings]` SET `owner`='' WHERE `type`='trainstation' AND `city`='{$data->land}'");
mysql_query("UPDATE `[users]` SET `trein`='0' WHERE `login`='$data->login'");
mysql_query("INSERT INTO `[logs]`(login,IP,code,area,time) values('$login','$IP','0','Drop trainstation',NOW())");
echo "<center><table width=90%><tr><td class=\"mainTxt\">Je hebt de treinstation weggedaan!</td></tr></table></center>";
}
ENDHTML;
if (isset($_POST['giveto']) && $data->login == $aantal->owner){
$dbres = mysql_query("SELECT `login` FROM `[users]` WHERE `login`='$newowner'");
$logincheck = mysql_num_rows($dbres);
$new = mysql_fetch_object($dbres);
if ($logincheck >= 1){
$newowner = $_POST['newowner'];
mysql_query("UPDATE `[buildings]` SET `owner`='$new->login' WHERE `type`='trainstation' AND `city`='{$data->land}'");
mysql_query("UPDATE `[users]` SET `trein`='1' WHERE `login`='$new->login'");
mysql_query("INSERT INTO `[logs]`(login,IP,code,area,time) values('$login','$IP','0','Give trainstation',NOW())");
echo "<center><table width=90%><tr><td class=\"mainTxt\">Je hebt de treinstation aan $new->login! gegeven</td></tr></table></center>";
}
else
echo "<center><table width=90%><tr><td class=\"mainTxt\"><font color=red>Die naam bestaat niet</td></tr></table></center>";
}
ENDHTML;
}
}
}
?>
</body>
</html>
------------------------
Als er eventuele andere fouten inzitten hoor ik het graag..
Maar je probleem zit hem in het feit dat je niet aan foutafhandeling doet.
je gaat er blindelings vanuit dat de volgende query juist is en resultaten geeft
Code (php)
1
<?php $gn1 = mysql_query("SELECT *,UNIX_TIMESTAMP(`vliegen`) AS `vliegen`,0 FROM `[users]` WHERE `login`='{$_SESSION['login']}'"); ?>
Maar de querie is niet goed en krijg je dus deze foutmeldingen.
Je weet ook te vertellen dat je die op meer plaatsen krijgt... allemaal foute queries waarvan je geen fouten afhandeld.
Ok dankje.. maar hoe verander ik dit dan.. want het moet wel werken natuurlijk..
maar vooral eerst beginnen om de fouten die de querie geeft weer af te vangen
mysql_query('query') or die( mysql_error() );
Neej kheb ze niet zelf gescheven.. mun vader is php scripter.. maar ik wil het zelf oplossen.. het was de bedoeling om het script hier en daar aan te passen + de layout.. om zo mijn eigen site te beginnen/showen maar het wil dus niet helemaal lukken :S
ik heb je zojuist een duw in de goede richting gegeven... je kan straks precies zien wat er mis is met je querie
michel schreef op 11.01.2008 14:17:
ik heb je zojuist een duw in de goede richting gegeven... je kan straks precies zien wat er mis is met je querie
Ik snap je niet precies srry..