Solved

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

Posted on 2014-12-25
5
80 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
  • 3
  • 2
5 Comments
 
LVL 58

Expert Comment

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

Open in new window

0
 

Author Comment

by:lawrence_dev
Comment Utility
Thanks Gary!  Merry Christmas!! Really appreciate your help!!
0
 

Author Comment

by:lawrence_dev
Comment Utility
Thanks!
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
Comment Utility
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
Comment Utility
I changed when I saw it and it worked great.  I just needed the right direction!!  Thanks!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now