Solved

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

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

840 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