Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How do I fi this if statement - looking for multiple matches

Posted on 2014-12-25
5
Medium Priority
?
98 Views
Last Modified: 2014-12-25
I could use some help with an if statement.

The code below does not work. How do I fix?
while ($row31 = $query31->fetch(PDO::FETCH_ASSOC))
{

if ($row31['manufacturer_name'] === VuQube|Timex|Lowrance|Seaview) {
echo "brand restriction";
}

Open in new window



This code works fine.  

while ($row31 = $query31->fetch(PDO::FETCH_ASSOC))
{

if ($row31['manufacturer_name'] === Lowrance) {
echo "brand restriction";
}

Open in new window

0
Comment
Question by:lawrence_dev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 40517780
if ('VuQube|Timex|Lowrance|Seaview',$row31['manufacturer_name'] !==false) {
    echo "brand restriction";
}

Open in new window

0
 

Author Comment

by:lawrence_dev
ID: 40517862
Thanks Gary!  Merry Christmas!! Really appreciate your help!!
0
 

Author Comment

by:lawrence_dev
ID: 40517864
Thanks!
0
 
LVL 58

Accepted Solution

by:
Gary earned 2000 total points
ID: 40517873
That code is wrong - too many tipples!

if (strpos('VuQube|Timex|Lowrance|Seaview',$row31['manufacturer_name'])!==false) {
    echo "brand restriction";
}

Open in new window

0
 

Author Comment

by:lawrence_dev
ID: 40517880
I changed when I saw it and it worked great.  I just needed the right direction!!  Thanks!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question