Angela Posted May 7, 2006 Share Posted May 7, 2006 Here is piece of code:[code]!empty($purpose) ? $mpurpose=" AND purposes = '".$purpose."'" : $mpurpose = "";!empty($marstat) ? $mmarstat=" AND marstat = '".$marstat."'" : $mmarstat = "";[/code]It gives search results from 2 selectboxes "purpose" and "marstat". How to change first line - that when only "purpose" is selected to see in search results for both values: "purpose" +(or) "marstat"? Quote Link to comment Share on other sites More sharing options...
zq29 Posted May 7, 2006 Share Posted May 7, 2006 I don't think your syntax is correct here, well, I have never seen ternary expressions written like that before...[code]$mpurpose = (!empty($purpose)) ? " AND purposes = '".$purpose."'" : "";[/code] Quote Link to comment Share on other sites More sharing options...
Angela Posted May 8, 2006 Author Share Posted May 8, 2006 [!--quoteo(post=372142:date=May 7 2006, 06:00 PM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ May 7 2006, 06:00 PM) [snapback]372142[/snapback][/div][div class=\'quotemain\'][!--quotec--]I don't think your syntax is correct here, well, I have never seen ternary expressions written like that before...[code]$mpurpose = (!empty($purpose)) ? " AND purposes = '".$purpose."'" : "";[/code][/quote]Yes, it is correct it works, but i need help of person with knowledge of such things. 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.