Solved

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

Posted on 2014-12-25
5
89 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 500 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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

717 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