ОП
Ольга Павлова

You have an error in your SQL syntax; check ...MySQL server version for the right syntax to use near '' at line 1

Помогите найти ошибку в php коде




if(empty($_POST['a1'])){

$a1 = 0 ;}

else{

$a1 = 1;

}

if(empty($_POST['a2'])){

$a2 = 0 ;}

else{

$a2 = $_POST['a2'];

}

if(empty($_POST['a3'])){

$a3 = 0 ;}

else{

$a3 = $_POST['a3'];

}

if(empty($_POST['a4'])){

$a4 = 0 ;}

else{

$a4 = $_POST['a4'];

}

if(empty($_POST['a5'])){

$a5 = 0 ;}

else{

$a5 = $_POST['a5'];

}

if(empty($_POST['a6'])){

$a6 = 0 ;}

else{

$a6 = $_POST['a6'];

}

$sql = "UPDATE users SET a1 = $a1, staj = 1, a2 = $a2, a3 = $a3, a4 = $a4, a5 = $a5, a6 = $a6 WHERE login = .$login.";

$query = mysql_query($sql);

if(!$query){

die('updating error'. mysql_error( ));

}

?>

АТ
Алексей Тихонов

В запросе много ошибок.
Правильно вроде так, но и тут не уверен, а пробовать неохота.
$sql = "UPDATE users SET a1 = ".$a1.", staj = 1, a2 = ".$a2.", a3 = ".$a3.", a4 = ".$a4.", a5 = ".$a5.", a6 = ".$a6." WHERE login = ".$login;

Погуглите "sql update example".

Похожие вопросы
Parse error: syntax error, unexpected T_ELSE in /home/u47601/сайт/check_login.php on line 81. 1.
2. Put in in, at, to or on. We live in a small town near Edinburgh. 1. ‘How do you know that?’ ‘I read it……. The newspap
check to be sure you have adequate disk space .if a driver is identified in the stop message. disable the driver or chek
syntax error, unexpected T_ELSE in Z:\home\1.ru\www\check.php on line 25
Please call customer service at ---to reset your password if you still have problems logging in. ПОМОГИТЕ ПЕРЕВЕСТИ
Надо в косвенную речь. . 1.Koalas live in Australia, the teacher said. 2. If you had worn your jacket,you wouldnt have go
где ошибка? ? sql пишет #1064 - You have an error in your SQL syntax
Use the verbs in the right form 1) from the black columns (to come) terrible noises
Помогите перевести фразу: The new one for me and you have to go to sleep in my room?
1)The girl looked at ...in the mirror 2)Freddy? you`ll have to do your homework ...