X
X
xlo2402018-04-07 02:31:59
PHP
xlo240, 2018-04-07 02:31:59

Why does the value in the table not change when mysql_query is true?

$conn returns true and the value in the table does not change.
How is this possible?
$arr[0] is 1
$conn = mysql_query("UPDATE `a_characteristik` SET `description` = 'fffffff' WHERE `a_characteristik`.`id` = '".$arr[0]."' ");
if($conn){
echo "tru";
}
else {
echo "fls";
}

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergej, 2018-04-07
@sayber

Well, for starters, you should open the documentation and read. Especially the highlighted block at the very beginning.
php.net/manual/ru/function.mysql-query.php
Second, I don't see $mysqli->error.
Third, why is the query variable called $conn ?
Maybe you just forgot to establish a connection to the database and immediately make a request?
Fourth, errors, logs, debug?
How did you understand that $arr[0] = 1. (where debug/trace)

X
xlo240, 2018-04-07
@xlo240

With connection to the database everything is fine.
$arr[0] we get from json. It's kind of like a string. Maybe this is the problem?
print mysql_affected_rows(); returns 0

I
iRedds, 2018-04-09
@iRedds

For other types of SQL queries, INSERT, UPDATE, DELETE, DROP, and others, mysql_query() returns TRUE on success and FALSE on error.
Use ..... or mysql_affected_rows() to find out how many rows were processed by DELETE, INSERT, REPLACE, and UPDATE queries.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question