Solved

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

Posted on 2014-12-25
5
83 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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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…
This article discusses how to implement server side field validation and display customized error messages to the client.
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.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

730 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