1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Need help in this.

Discussion in 'PHP' started by balasun, Jul 30, 2008.

  1. #1
    Hello all,

    I need ur help in the below work,

    I entered data in to mysql Db by using addslashes and htmlspecialchars in one field data. the data in the field prodname in DB like 37\" HD TV.

    The problem is when i made search operation thre LIKE keyword like 37" HDTV.

    The result does not comes. I want to get the result for that.
    SEMrush
    Myquery is

    SELECT * FROM page_content WHERE modelno LIKE '%37" HDTV%' or modelno LIKE '%37" HDTV' or prodname LIKE '%37" HDTV' or prodname LIKE '%37" HDTV%' or prodname LIKE '37" HDTV%'
    Please help me if u know the answer..
     
    balasun, Jul 30, 2008 IP
    SEMrush
  2. zerxer

    zerxer Peon

    Messages:
    369
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Don't use htmlspecialchars before inserting it because you don't want " to turn into ". Just use addslashes to make sure that they're escaped properly. I've noticed that my POST variables are always already escaped so I'd recommend doing stripslashes() first and then doing addslashes() so that \" doesn't actually get stored in the database.
     
    zerxer, Jul 30, 2008 IP