Jump to content

Need help


Angela

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"?
Link to comment
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]
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.