Jump to content

Recommended Posts

Ok, so I'm trying to add an article(title, content, tags) to my database. Each of those field is stored in POST.

When i use a ' character in any of those fields, the query fails. (I previously used mysqli_real_escape_string on them)

 

How should I filter the input in order for everything to be safe and for me to be able to use ' in those fields? 

Link to comment
https://forums.phpfreaks.com/topic/279733-post-filtering-wo-__escape_string/
Share on other sites

Yes. The query for the tags is another one, but I don't have any problems with that as I don't need nonalphanumeric characters in the tags. 
 

$ok1 = mysqli_query($connection, "INSERT INTO blog_posts(title, text, date_posted)
		VALUES('$title', '$text', '$datestamp')");
Edited by tsuby
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.