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

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

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

google shop client API returns 400 bad request error while adding an item -