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

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -