SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Feb 2009
    Posts
    194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    displaying html markup from mysql database.. or suggested alternatives

    I made a very simple CMS, and I just want a way for posts contained within it to have anchors, imgs, headings etc, in a way that's easy to implement and for the user to update..
    I sort of know of realescapestring, stripslashes, n2lbr (which I have in there right now) and things like that but don't quite know the best way to combine them together in the CMS itself (which just grabs data from a form and writes it to the database) or in the queries themselves.
    I'm also having issues with quotes added through the database, which happens often as there are a lot of reviews and such popping up with slashes on the end..

    right now the CMS code in brief looks like:

    Code PHP:
    $description = mysql_real_escape_string($_POST['show_description']);
    $updatestring = "UPDATE tbl_shows SET show_description='".$description."' WHERE show_id=".$thisshow;
     
     
    <td><textarea name="show_description" id="show_description" cols="70" rows="15"><?php echo stripslashes($row['show_description']);   ?></textarea></td>

    and then in the page itself:
    Code PHP:
    <?php if ($row['show_description'] == NULL) {echo $row['show_blurb'];}
    else {echo nl2br($row['show_description']);} ?>

    or maybe there's a good tutorial on this somewheres?? i am just getting quite confused

  2. #2
    SitePoint Addict NetNerd85's Avatar
    Join Date
    Aug 2005
    Location
    Australia
    Posts
    298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What version of PHP are you running? and do you have magic quotes on?
    a new day, a new beginning
    never follow the crowd, the crowd is poor!

  3. #3
    SitePoint Zealot
    Join Date
    Feb 2009
    Posts
    194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Version 5.2.12 and no magicquotes... everywhere seems to think it's not a great idea.


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
  •