Jump to content

Archived

This topic is now archived and is closed to further replies.

Angela

Need help

Recommended Posts

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"?

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
[!--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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.