pioneerx01 Posted December 14, 2010 Share Posted December 14, 2010 I am running a search query from MYSQL and it works, but now I want to get a little custom. I am selecting one field, out of many called paid1 which in database is either Yes or No. I want to do this: if paid1 is NO display Pay Now and everything else display Yes. I want this to be under new heading of paid1b. So the code should look something like this: $paid1b= if(['paid1'}==No){echo "Pay Now";} else {echo "YES";} But I am missing something somewhere. What is it? Thanks Link to comment https://forums.phpfreaks.com/topic/221598-i-am-missing-a-little-thing-somewhere/ Share on other sites More sharing options...
denno020 Posted December 14, 2010 Share Posted December 14, 2010 echoing text into a variable? With your code I would write it like this: if({'paid1'} == no){ $paid1b = "Pay Now"; }else{ $paid1b = "Yes"; } echo $paid1b Don't quote me on the formatting of that above code, I'm always getting confused between () [] {}, and the needs for them in different situations, but the gist of what I've written should work.. Hope that helps Denno Link to comment https://forums.phpfreaks.com/topic/221598-i-am-missing-a-little-thing-somewhere/#findComment-1147058 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.