D
D
doublench212014-10-19 19:44:46
PHP
doublench21, 2014-10-19 19:44:46

What is wrong with the SQL query?

There was a request without update field `short`. Everything worked as it should. Then it was necessary to add the `short` field to the table. Changed the query itself:

$sql = "UPDATE indexing_link SET title='" . $title . "', short='" . $short . "' WHERE id=" . $id_current_url;

All variables have been checked before the request. Everything is fine. The same request from phpmyadmin works. And the script gives an error. What's the matter ?
$sql = "UPDATE indexing_link SET title='" . $title . "', short='" . $short . "' WHERE id=" . $id_current_url;
mysqli_query($mysqli, $sql) or die('Error_ (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());

Error_(0)
This is how it works:
$sql = "UPDATE indexing_link SET title='" . $title . "' WHERE id=" . $id_current_url;

And so no:
$sql = "UPDATE indexing_link SET title='" . $title . "', short='" . $short . "' WHERE id=" . $id_current_url;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeniy Samoilenko, 2014-10-19
@doublench21

Like the request is written correctly, in the table added this field "short"?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question