probleem met WHERE
klaas
31/01/2007 19:13:00Ik krijg deze foutmelding:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM bets WHERE bet='x' AND wedid='9' AND userid='1'' at line 1
Dit is het stuk waar het over gaat.
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM bets WHERE bet='x' AND wedid='9' AND userid='1'' at line 1
Dit is het stuk waar het over gaat.
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?
if($saldo - $betg >= 0){
$sql = "SELECT FROM bets WHERE bet='".$bet."' AND wedid='".$wedid."' AND userid='".$userid."'";
$res = mysql_query($sql) or die (mysql_error ());
$count = mysql_num_rows($res);
if($count == 0){
$sql2 = "INSERT INTO bets (bet,betg,wedid,userid) VALUES ('".$bet."','".$betg."','".$wedid."','".$userid."'";
$res2 = mysql_query($sql2) or die (mysql_error ());
}else{
$row = mysql_fetch_object ($res);
$betg2 = htmlspecialchars($row->betg);
$sql2 = "UPDATE bets SET betg='".$betg+$betg2."' WHERE bet='".$bet."' AND wedid='".$wedid."' AND userid='".$userid."'";
$res2 = mysql_query($sql2) or die (mysql_error ());
}
$sql3 ="UPDATE phpmylogon SET saldo='".$saldo-$betg."' WHERE id='".$userid."'";
echo "Bet is succesvol toegevoegd";
}else{
echo "Je hebt geen hoog genoeg saldo.";
}
?>
if($saldo - $betg >= 0){
$sql = "SELECT FROM bets WHERE bet='".$bet."' AND wedid='".$wedid."' AND userid='".$userid."'";
$res = mysql_query($sql) or die (mysql_error ());
$count = mysql_num_rows($res);
if($count == 0){
$sql2 = "INSERT INTO bets (bet,betg,wedid,userid) VALUES ('".$bet."','".$betg."','".$wedid."','".$userid."'";
$res2 = mysql_query($sql2) or die (mysql_error ());
}else{
$row = mysql_fetch_object ($res);
$betg2 = htmlspecialchars($row->betg);
$sql2 = "UPDATE bets SET betg='".$betg+$betg2."' WHERE bet='".$bet."' AND wedid='".$wedid."' AND userid='".$userid."'";
$res2 = mysql_query($sql2) or die (mysql_error ());
}
$sql3 ="UPDATE phpmylogon SET saldo='".$saldo-$betg."' WHERE id='".$userid."'";
echo "Bet is succesvol toegevoegd";
}else{
echo "Je hebt geen hoog genoeg saldo.";
}
?>
Gewijzigd op 01/01/1970 01:00:00 door Klaas
PHP hulp
20/11/2024 00:13:30Terence Hersbach
31/01/2007 19:17:00fout1:
$sql = "SELECT * FROM bets WHERE bet='".$bet."' AND wedid='".$wedid."' AND userid='".$userid."'";
fout2:
$sql2 = "INSERT INTO bets (bet,betg,wedid,userid) VALUES ('".$bet."','".$betg."','".$wedid."','".$userid."')";
$sql = "SELECT * FROM bets WHERE bet='".$bet."' AND wedid='".$wedid."' AND userid='".$userid."'";
fout2:
$sql2 = "INSERT INTO bets (bet,betg,wedid,userid) VALUES ('".$bet."','".$betg."','".$wedid."','".$userid."')";
Gewijzigd op 01/01/1970 01:00:00 door Terence Hersbach