i think its pretty easy but i couldn’t find the answer with searching
i want to do something like this
if(!$user_logged)
{
$q = "select `id` , 0 as choice from tbl1";
}
else
{
$q = "select tbl1.id , tbl2.choice as choice from tbl1 join tbl2 ON .... ";
}
i want to select 0 as the choice if user is not logged so i wouldn’t need to do the extra join
but i get
Unknown column '0' in 'field list'
Try this Query :-