SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    using strip tags to take <p> tags out

    I'm using the code below to strip html tags out of a string from the database, and I'm sure it looks pretty close to me, but for some reason the html continues to show.

    Code:
    $d=mysql_query("select Id_Hot, Nom_Hot, LongDesc_Hot FROM tbl_hotels WHERE Id_Hot=".$hotelID." ");
    while($f=mysql_fetch_assoc($d)){ 
    $group = strip_tags($f['LongDesc_Hot'], '<p>');
    This is the output:

    Code:
    <p>The all-inclusive Barceló Tambor Beach, a five-star resort located on Playa Tambor - Puntarenas , is a jewel on the southern tip of the Nicoya Peninsula. The volcanic sands and gentle swell of the sea, reflecting the brilliant blue sky, make this a perfect place for sunbathing, water sports, or simply strolling along the 6km beach.</p>
    
    <p>Awarded a Blue Flag, for safe clean beaches, the all-inclusive Barceló resort Tambor Beach provides families and couples with a place to play in the sun, take a dip in the calm turquoise waters, or experience a romantic sunset.</p>
    
    <p></p>
    
    <p>Families will love our children’s miniclub, where our professional staff entertains your children with thrilling activities and arts and crafts while you fulfil your sense of adventure. The all-inclusive Barceló Tambor Beach is the perfect backdrop for a romantic tropical getaway or your dream destination wedding. Pamper yourself with a couple’s massage while listening to the soothing sound of the gentle waves washing up on the shore. Celebrate with the one you love at the all-inclusive Barceló Tambor Beach hotel! With an endless range of exotic fauna and flora, discover the grandeur of nature in this fascinating region at the ecological park at all-inclusive Barceló Tambor Beach, Cabo Blanco National Park, or in the nearby Curu Wildlife Reserve.</p>
    I need to trim them out as I'm using part of it in the meta description

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2013
    Posts
    26
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    just use like this

    Code:
    $group = strip_tags($f['LongDesc_Hot']);
    you were allowing "<p>" tag

  3. #3
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    tut, thank you pbsonawane.

    Whatamistakadamaka!


Bookmarks

Posting Permissions

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