buds2000 Posted June 21, 2007 Share Posted June 21, 2007 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 Quote Link to comment Share on other sites More sharing options...
teng84 Posted June 21, 2007 Share Posted June 21, 2007 use the loop and set it on three rounds ASTIG!! Quote Link to comment Share on other sites More sharing options...
buds2000 Posted June 21, 2007 Author Share Posted June 21, 2007 I have no idea what a loop is nor how to set it on 3 rounds. I tried the code below but still only checks w1... if ($searchdata<>"$w1" or "$w2" or "$w3){ Quote Link to comment Share on other sites More sharing options...
btherl Posted June 21, 2007 Share Posted June 21, 2007 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. Quote Link to comment Share on other sites More sharing options...
buds2000 Posted June 21, 2007 Author Share Posted June 21, 2007 "And thats why i came to PHP Freaks!" The problem is solved. Thanks for helping me with this. 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.