Results 1 to 17 of 17
  1. #1
    ABW Ambassador Doug247's Avatar
    Join Date
    January 18th, 2005
    Location
    DE USA
    Posts
    931
    PHP Help Please
    Ok I think I needs some sleep but I am I am fighting it.

    Can someone please save my sanity and tell me why this is not working

    $iName = str_replace ($Brand, '',$iName);

    All I am trying to do is remove the brand name form the product name. Why merchant feel they need to add the brand name to the product name colum is beyond me. If they ar going to do that they should be consistant at call the column brandnameproduct.

    Sorry about the rant please help!
    Thanks,
    Doug

  2. #2
    Grandma broke her coccyx! Uncle Rico's Avatar
    Join Date
    May 8th, 2007
    Location
    North Carolina
    Posts
    2,238
    How about this.

    PHP Code:
    $iName str_replace ($Brand""$iName); 

  3. #3
    Yup, Sure ... now let me check ... Cagles Mill's Avatar
    Join Date
    January 18th, 2005
    Location
    The Midwest
    Posts
    646
    Yup! SeymourButts has you covered. Looks like you're missing a quotation mark.
    Rick M.
    I would rather have a bottle in front of me, than have a frontal lobotomy!
    Does your bubblegum lose its flavor on the bedpost overnight?

  4. #4
    ABW Ambassador Boom or Bust's Avatar
    Join Date
    February 3rd, 2008
    Posts
    3,955
    Those are two apostrophes which in this context represent opening and closing quotes. I'm an ASP kind of guy so can't help otherwise...



    X

  5. #5
    Full Member
    Join Date
    October 22nd, 2006
    Posts
    200
    Just a guess is your brand variable $iBrand?

  6. #6
    ABW Ambassador bettylou's Avatar
    Join Date
    December 27th, 2005
    Location
    Indiana
    Posts
    595
    If I remember right, I think that str_replace is case sensitive. Could that be it?

  7. #7
    ABW Ambassador Doug247's Avatar
    Join Date
    January 18th, 2005
    Location
    DE USA
    Posts
    931
    Thanks Guys. I try to get it squared today.
    Thanks,
    Doug

  8. #8
    ABW Ambassador PatrickAllmond's Avatar
    Join Date
    September 20th, 2005
    Location
    OKC
    Posts
    1,219
    its,

    I concur. Whenever I do something like this I always would use:

    $iName = str_replace (strtolower($Brand), "", $iName);

    and since to me that looks messy (meaning I'd have to think about what that does in a month as I might forget) I would go one step further and turn it into a function:

    function removebrand($productname,$brand)
    {
    return str_replace(strtolower($brand), "", $productname);
    }

    ..and then just call it:

    $iName = removebrand($iName);
    ---
    This response was masterly crafted via the fingers of Patrick Allmond who believe you should StopDoingNothing starting today.
    ---
    Focus Consulting is where I roll | Follow @patrickallmond on Twitter
    Search Engine Marketing | Search Engine Optimization | Social Media | Online Video

  9. #9
    Comfortably Numb John Powell's Avatar
    Join Date
    October 17th, 2005
    Location
    Bayou Country, LA
    Posts
    3,432
    All I am trying to do is remove the brand name form the product name.
    Could you give an example of how your data actually looks? Is it something like "Nike/Jogging" or "Nike Jogging"?


  10. #10
    Newbie
    Join Date
    January 15th, 2008
    Location
    Portage, MI
    Posts
    39
    Just curious,

    Why would you want to remove the brand name? Couldn't that be used for PPC?

  11. #11
    ABW Ambassador Doug247's Avatar
    Join Date
    January 18th, 2005
    Location
    DE USA
    Posts
    931
    Quote Originally Posted by country
    Just curious,

    Why would you want to remove the brand name? Couldn't that be used for PPC?
    I got it figured out...it was a case problem. Ex Brandname vs BrandName

    I wanted to remove the brand name from the product name because I have a field for the brand and wanted more control over what is displayed.

    I'm not familiar at all with PPC, how could the brand name being part of the product name help with PPC?
    Thanks,
    Doug

  12. #12
    Newbie
    Join Date
    January 15th, 2008
    Location
    Portage, MI
    Posts
    39
    I was just asking because my understanding with PPC is the more relevant the ad the lower the cost you can qualify for.

    In other words: if your ad is for Nike xyz shoe and your page name is xyz-shoe only, then that ad wouldn't be as relevant as a page that has Nike-xyz-shoe as the page name or included in the page name.

    The more relevant your page is too the ad the better PPC ranking you can get. Possibly getting a better ranking for less money than your competition.

    I may be wrong on this but that is my understanding. Maybe somebody can clear this up for us.

  13. #13
    Newbie
    Join Date
    June 17th, 2007
    Posts
    21
    Quote Originally Posted by itsupportnotes
    I got it figured out...it was a case problem. Ex Brandname vs BrandName
    you could also use str_ireplace which is case insensitive.

  14. #14
    ABW Ambassador Doug247's Avatar
    Join Date
    January 18th, 2005
    Location
    DE USA
    Posts
    931
    Quote Originally Posted by DataFeedr.com
    you could also use str_ireplace which is case insensitive.

    Cool thanks. I'm gonna have to start writing down all the php functions on yellow stickies and stick them to the monitor. As always ABW is great!
    Thanks,
    Doug

  15. #15
    Newbie
    Join Date
    June 17th, 2007
    Posts
    21
    Quote Originally Posted by itsupportnotes
    Cool thanks. I'm gonna have to start writing down all the php functions on yellow stickies and stick them to the monitor.
    i think if i had done that, i would have lost my monitor years ago under a pile of stickies.

  16. #16
    ABW Ambassador PatrickAllmond's Avatar
    Join Date
    September 20th, 2005
    Location
    OKC
    Posts
    1,219
    down the php help file to your hard drive. It comes in windows .CHM format. I keep it on my Windows desktop. It is open a good chunk of the day. Any manuals like that that I can get in PDF or CHM format I keep them handy.
    ---
    This response was masterly crafted via the fingers of Patrick Allmond who believe you should StopDoingNothing starting today.
    ---
    Focus Consulting is where I roll | Follow @patrickallmond on Twitter
    Search Engine Marketing | Search Engine Optimization | Social Media | Online Video

  17. #17
    Newbie
    Join Date
    June 17th, 2007
    Posts
    21
    that reminds me, i use the php search engine in the firefox browser. it makes it easy to search php.net for a function and if i don't know what function i need, i just type in a description of what i want and sometimes the search results get me what i need.

  18. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. PHP question - include(file.php) with variables
    By teezone in forum Programming / Datafeeds / Tools
    Replies: 8
    Last Post: September 4th, 2009, 04:54 PM

Posting Permissions

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