0 / 0 / 0
Регистрация: 09.08.2015
Сообщений: 15
1

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the r

09.08.2015, 22:13. Показов 765. Ответов 2
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Доброго времени суток всем. Вознакила ошибка "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 ')' at line 1" при запуске, т.е. как бы все работает, но при запуске файла вылазит эта штука, как я поняд это warning простой или поправьте, если ошибаюсь. Не могу понять из-за чего эта дрянь происходит.
index.php:
PHP/HTML
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
<?php
function __autoload($name){
    include "classes/$name.class.php";
}
$db = new DbWork('localhost', 'livci', '2614506', 'shop');
?>
<!DOCTYPE html>
<html lang="ru">
    <head>
        <meta charset="utf-8">
        <title>Remind Password</title>
        <link rel="stylesheet" href="css/style.css">
    </head>
    <body>
    <section>
            <a href="included/registration.inc.php">Регистрация</a>
            <a href="included/users.inc.php">Пользователи</a>
    </section>
<?php
if($_SERVER["REQUEST_METHOD"] = "POST"){
    include 'included/save_user.inc.php';
}
?>
    </body>
</html>
DbWork.class.php:
PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
class DbWork{
    private $_conn;
    
    function __construct($host, $name, $pass, $db){
        $this->_conn = new mysqli($host, $name, $pass, $db);
    }
    function saveUser($login, $email, $password){
        $sql = "INSERT INTO users (login, email, password) VALUES ('$login', '$email', $password)";
        $this->_conn->query($sql) or die($this->_conn->error);
    }
    function clearData($data, $item){
        switch ($item){
            case 's': strip_tags(trim($data)); break;
            case 'i': abs((int)$data);
            
        }
    }
}
?>
save_user.inc.php:
PHP
1
2
3
4
5
6
7
8
9
10
11
<?php
$login = $db->clearData($_POST['login'], 's');
$password = $db->clearData($_POST['password'], 's');
$email = $db->clearData($_POST['email'], 's');
if(empty($login) or empty($password) or empty($email)){
    $errMsg = 'Заполните обязательные поля';
}else{
    $db->saveUser($login, $email, $password);
    header('Location: '.$_SERVER["REQUEST_URI"]);
}
?>
Добавлено через 1 минуту
А да, на форуме смотрел похожие темы, но что-то не помогло, видимо я дурачок
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
09.08.2015, 22:13
Ответы с готовыми решениями:

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 '' at line 1
При написании обработчика данных формы ввода,произошла проблема с MySQL,браузер показывает такое...

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 '111.bdbd12 b' a
Всем привет, ребята у меня странная ошибка с БД короче.. Создаю таблицу все норм. создается а вот...

Ошибка: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
Здравствуйте, php, mysql начала изучать совсем недавно, сегодня столкнулась с такой ошибкой: &quot;You...

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the rig
Помогите пожалуйста. Когда создаю таблицу: CREATE TABLE test(ID INT NOT NULL PRIMARY KEY...

2
6 / 6 / 6
Регистрация: 15.02.2015
Сообщений: 53
10.08.2015, 10:55 2
Цитата Сообщение от livci Посмотреть сообщение
VALUES ('$login', '$email', $password)";
Тут кавычки пропустили - '$password' .
0
0 / 0 / 0
Регистрация: 09.08.2015
Сообщений: 15
10.08.2015, 16:55  [ТС] 3
Безмерно благодарен, помогло.
0
10.08.2015, 16:55
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
10.08.2015, 16:55
Помогаю со студенческими работами здесь

Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version f
insert into пользователь (Фамилия,Имя,Отчество,Пол,Группа) value...

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your...

Ошибка SQL запроса #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax t
Помогите пожалуйста! CREATE TABLE `tickets` ( `id` int(4) NOT NULL auto_increment, `user`...

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
У меня когда выполняется запрос на подключение с базой данных выскочила какая-то ошибка. ...

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 '
чёто не робит &lt;?php include (&quot;db.php&quot;); session_start(); if (!empty($_SESSION) and...

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
где допустил ошибку? You have an error in your SQL syntax; check the manual that corresponds to...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
3
Ответ Создать тему
Опции темы

КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2023, CyberForum.ru