UPDATE table1 SET row1 =CONCAT( row1, 'word1, word2')
I want to add a condition to the query above.
I'm looking to add text values to row1 on table1, which already contains some texts, the query above does the trick, but additionally to that, I need to add a condition. I have another table called "table2", with a column, let's say "row2" that equals to "1". I need to run the query above IF row2 in table2 equals to 1.
I'm running the query directly on PHP MyAdmin
Thanks in advance.
$query = "SELECT `row2` FROM `table2`";
$res = mysqli_query($query);
$row = mysqli_fetch_array($res);
if($row['row2'] == 1)
{
//run your update table code: UPDATE table1 SET row1 =CONCAT( row1, 'word1, word2')
}