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 Link to comment https://forums.phpfreaks.com/topic/56487-solved-a-little-php-help/ 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!! Link to comment https://forums.phpfreaks.com/topic/56487-solved-a-little-php-help/#findComment-278985 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){ Link to comment https://forums.phpfreaks.com/topic/56487-solved-a-little-php-help/#findComment-278993 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. Link to comment https://forums.phpfreaks.com/topic/56487-solved-a-little-php-help/#findComment-278997 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. Link to comment https://forums.phpfreaks.com/topic/56487-solved-a-little-php-help/#findComment-279001 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.