0
Example :
$query = "update tabela set coluna1 = 1 where id = {$id_m} union
update tabela set coluna2 = 1 where id = {$id_v}";
0
Example :
$query = "update tabela set coluna1 = 1 where id = {$id_m} union
update tabela set coluna2 = 1 where id = {$id_v}";
1
UNION is used to combine the result from Multiple SELECT statements into a single result set. https://dev.mysql.com/doc/refman/5.0/en/union.html
Initially used only in SELECT.
Browser other questions tagged php mysql
You are not signed in. Login or sign up in order to post.
Is there any way I can change data from different columns but leaving it in one query?
– Naldson
try: $query = "update table set column1 = 1 Where id = {$id_m}; update table set column2 = 1 Where id = {$id_v}";
– Johnathan Douglas
Returned a syntax error for the second update...
– Naldson
here i got $sql = 'update category set name=? Where id=? ; update category set name=? Where id=? '; $bindings = array('abc',1, 'cba',2); $stmt = $Pdo->prepare($sql); $result = $stmt->execute($bindings); echo $result; //true
– Johnathan Douglas