Jump to content

[SOLVED] MySQL Inserting HTML Chars


fragge

Recommended Posts

Ok so I've written a PHP CMS for my site with a front-end interface for adding news articles (Title, Date and Text). I want to be able to insert characters such as ' and all the usual HTML stuff, without allowing for SQL injection - is there a way pass the single quotes through without letting them break the INSERT query and thus leaving my app wide open? Forums seem to do it just fine, so I'm sure there's a very simple answer like mysql_real_escape or something? Don't know what half of them actually do -_-

 

Edit: Did a little looking around, used mysql_real_escape_string on all values, then stripslashes() for the output - worked a treat.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.