Results 1 to 6 of 6
  1. #1
    ABW Ambassador Doug247's Avatar
    Join Date
    January 18th, 2005
    Location
    DE USA
    Posts
    931
    A little preg_match help please
    Could someone check this little bit of code? I am trying to test for the word 'phillies' in the the $iName. If the word exists then I want that item to be added or updated to my database. I printed the contents of $iName and 'phillies' does exist in the string. Help Please..Please...Please

    PHP Code:
    .
    .
    .
    $pattern '/^phillies/';
    if (
    preg_match($pattern,$iName )) {  
    $query "select
    id 
    from 
    products 
    where 
    sku = '
    $iSku
    and merchant = '
    $merchant
    .
    .


    Thanks
    Thanks,
    Doug

  2. #2
    ABW Ambassador bettylou's Avatar
    Join Date
    December 27th, 2005
    Location
    Indiana
    Posts
    595
    Doug,

    You need to have your curly bracket directly following the word if.

  3. #3
    ABW Ambassador bettylou's Avatar
    Join Date
    December 27th, 2005
    Location
    Indiana
    Posts
    595
    Doug,

    Ignore that stupid post above, I am doing too many things at once. Sorry!

  4. #4
    ABW Ambassador bettylou's Avatar
    Join Date
    December 27th, 2005
    Location
    Indiana
    Posts
    595
    OK, sorry once again, too much cold medicine for me!

    I am definitely not a wiz at regular expression, but doesn't including the ^ mean that the string has to begin with the pattern? Try taking it out. Again, not a wiz!

  5. #5
    ABW Ambassador Doug247's Avatar
    Join Date
    January 18th, 2005
    Location
    DE USA
    Posts
    931
    Bingo! Many thanks and hope the cold gets better. Thanks!
    Thanks,
    Doug

  6. #6
    ABW Ambassador bettylou's Avatar
    Join Date
    December 27th, 2005
    Location
    Indiana
    Posts
    595
    Thanks Doug, they should put an additional note next to the "heavy machinery" thing on the label about not posting on forums while taking this product.

  7. Newsletter Signup

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •