Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I fix this strpos statement?

Posted on 2014-12-29
5
Medium Priority
?
87 Views
Last Modified: 2014-12-29
How to I fix this strpos statement?  I attempted to have it pregmatch 'GTIN' within the string and could not get that to work correctly, and now I am attempting t use the entire line of text....

I am getting the following error:  
Parse error: syntax error, unexpected '') {' (T_CONSTANT_ENCAPSED_STRING)

if (strpos('"Invalid GTIN value"|"Insufficient product identifiers: Missing GTIN attribute."',$row13['errordesc']')  {
        $upc="";
        } else {
        $upc="$row13['upc']";
        }

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
  • 2
  • 2
5 Comments
 
LVL 58

Assisted Solution

by:Gary
Gary earned 800 total points
ID: 40522747
if (strpos('"Invalid GTIN value"|"Insufficient product identifiers: Missing GTIN attribute."',$row13['errordesc'])!==false)  {
        $upc="";
        } else {
        $upc="$row13['upc']";
        }

Open in new window

0
 
LVL 31

Accepted Solution

by:
Marco Gasi earned 1200 total points
ID: 40522749
Try this:
if (strpos("Invalid GTIN value"|"Insufficient product identifiers: Missing GTIN attribute.", $row13["errordesc"]))
				{
        $upc="";
        } else {
        $upc= $row13['upc'];
        }

Open in new window

0
 

Author Comment

by:lawrence_dev
ID: 40522971
Gary,
I got an error on yours but I appreciate your consistent help very much!!!
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)

Marco,
Yours worked great!  Thanks!
0
 

Author Closing Comment

by:lawrence_dev
ID: 40522972
Thanks!!
0
 
LVL 58

Expert Comment

by:Gary
ID: 40523066
Yeah I missed this as well which Marco corrected

$upc="$row13['upc']";
0

Featured Post

WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

Question has a verified solution.

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

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

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