mysql - If statement on variables for insert into table php -


i have number of variables being inserted mysql table, on 1 of variables need insert table, there way if $x = y 'a' else 'b' within insert statement?

use different variable result, use in query.

$tmp = ($x == 'y' ? 'a' : 'b'); /* if $x==y $tmp = else $tmp = b */ $q = "insert tbl set coloumn = $tmp"; 

Comments

Popular posts from this blog

css - I want to align grid in center -

Contact Form PHP Email Script -

python - SWIG function not printing output -