After clicking on the "Save" button, the following method works:

protected function obr(){ if (!empty($_FILES['img_src']['tmp_name'])){ if (!move_uploaded_file($_FILES['img_src']['tmp_name'],'img/'.$_FILES['img_src']['name'])){ exit("Не удалось загрузить изображение"); } $img_src = 'img/'.$_FILES['img_src']['name']; }else{ exit("Необходимо загрузить изображение"); } $title = $_POST['title']; $date = date("Ymd", time()); $discription = $_POST['discription']; $text = $_POST['text']; $cat = $_POST['cat']; if (empty($title) || empty($text) || empty($discription)){ exit("Не заполненны обязательные поля"); } $query = "INSERT INTO statii (title, img_src, date, text, discription, cat) VALUES ('$title', '$img_src', '$date', '$text', '$discription, '$cat')"; if(!mysql_query($query)){ exit("Ошибка ввода в базу данных".mysql_error()); }else{ $_SESSION['res'] = "Изменения внесены успешно"; header("Location:?option=add_statii"); exit(); } } 

Work ends here:

 if(!mysql_query($query)){ exit("Ошибка ввода в базу данных".mysql_error()); } 

Error on the screen: http://i.stack.imgur.com/DTIv7.png

What is my problem?

    2 answers 2

    A single quote at the end of $discription omitted when composing a query.

    Also, you may need a semicolon after the request.

      Your request is not properly formed, you must restore the quotation mark (lead to this format)

       $query = "INSERT INTO statii (title, img_src, date, text, discription, cat) VALUES ('$title', '$img_src', '$date', '$text', '$discription', '$cat')";