deepman007 Posted March 20, 2008 Share Posted March 20, 2008 Hi I'm new to PHP and I saw this "$sku_stock = (allowBackOrders) ? "" : " AND S.SKU_Stock > 0"; " What does it mean? I dont understand "? :" thanks Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted March 20, 2008 Share Posted March 20, 2008 This is called the ternary operator, it is the short way of writing an if/else statement. This: $sku_stock = (allowBackOrders) ? "" : " AND S.SKU_Stock > 0"; Is the short version of writing: <?php if (allowBackOrders){ $sku_stock = ""; } else { $sku_stock = " AND S.SKU_Stock > 0"; } ?> Quote Link to comment Share on other sites More sharing options...
deepman007 Posted March 21, 2008 Author Share Posted March 21, 2008 you can put Query " AND S.SKU_Stock >0 to a varible ? Thanks Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted March 21, 2008 Share Posted March 21, 2008 yes, sure. it's a string: $var = " AND S.SKU_Stock > 0"; Quote Link to comment Share on other sites More sharing options...
Orio Posted March 21, 2008 Share Posted March 21, 2008 If you still need explanations, check the manual: http://www.php.net/manual/en/language.operators.comparison.php Scroll down a bit. Orio. Quote Link to comment Share on other sites More sharing options...
deepman007 Posted March 21, 2008 Author Share Posted March 21, 2008 Thank you very much Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.