Jump to content

[SOLVED] A little PHP help!


buds2000

Recommended Posts

The statement below is the problem. After i have searched 3 fields in my table for a name, I want to execute the code below if no match were found. My problem is with the first line.

 

if ($searchdata<>"$w1")

 

I'm searching 3 fields:w1, w2, w3. This only checks field w1. I need to check all 3 before the else statement.

 

ANY Suggestions?

 

 

 

===============================================================================

if ($searchdata<>"$w1"){

      echo "<p align=\"left\">      <font size=\"+2\" color=\"#DE3A53\">!</font> <font size=\"+1\">No Results Found Matching:</font><b>  <font color=\"#DE3A53\">$searchdata</font></b><img src=\"clear.gif\" width=\"250\" height=\"1\">[<a href=\"index.php\">Go Back</a>]  </p>";

  }

else

 

Link to comment
Share on other sites

The syntax is:

 

if ($searchdata <> $w1 && $searchdata <> $w2 && $searchdata <> $w3)

 

Computers are not that smart, so you need to specify $searchdata three times to compare it to three different 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.