I’ve never done an if in a mysql query. Based on: http://dev.mysql.com/doc/refman/5.0/en/if-statement.html
I came up with this, but no joy.
mysql_query("UPDATE skew_trkg_slave IF observations_needed = observations_completed THEN SET minor_cycle_completed = '1'; WHERE " . $skew_trkg_slave_where . "") or die(mysql_error());
How close am I?
r937
December 23, 2011, 2:43am
2
UPDATE skew_trkg_slave
SET minor_cycle_completed = 1
[COLOR="#0000FF"]WHERE observations_needed = observations_completed
AND [/COLOR][I]$skew_trkg_slave_where[/I]
Thank you very much r937. Could that have been done with a if statement? If so, how would it be written the the procedural style?
r937
December 23, 2011, 3:33am
4
no, because an IF statement is used for flow-of-control execution, not to evaluate column contents in each row
Thanks again r937. I’ll look into flow-of-control execution. It sounds like something I should at least know about.