Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4082810
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:14:01+00:00 2026-05-20T18:14:01+00:00

This might be a really stupid and self-answering question: I am stripping down my

  • 0

This might be a really stupid and self-answering question: I am stripping down my submissions like so (but need to submit to my table and also echo out the data to the screen):

$num_of_badges = stripslashes(trim(mysql_real_escape_string($_POST['num_of_badges'])));

Of course the data is passed, but does the stripslashes()``** here defeat the purpose ofmysql_real_escape()`?

So: Bill’s becomes Bills in the table and echo on the screen.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T18:14:02+00:00Added an answer on May 20, 2026 at 6:14 pm

    need to submit to my table and also echo out the data to the screen

    this statement is a key of all your problems.

    while trim() and conditional stripslashes() are “submissions” related, mysql_real_escape_string is completely different matter, it has nothing to do with submissions, input, output and all that stuff. It has relation to SQL queries only.

    So, these functions should never be mixed.

    • stripslashes should be conditional. only if magic quotes is on. can be checked with get_magic_quotes_gpc(). Applied to HTTP input variables only.
    • trim is quite useless most of time but let it be, apply it to input.

    these two above can be used blindly, at the top of your code. but third one,

    • mysql_real_escape_string, as it’s been said already, is completely different matter. It should be used on the strings that going to be inserted into query. Not on strings going to be echoed on screen. Not on numbers or identifiers, but strings (quoted blocks of data) going into query. So, mysql_real_escape_string can be used right before query building and nowhere else. And should be very last action done on your data before it goes to be inserted into query.

    And also I hope you’re not going to print your data right after inserting it into database.
    You rather have tho make a redirect, and then read your newly written data back from database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I might be very stupid to ask this question. But I really hav no
This might be a very stupid question :P But I found this really interessting:
This might be a really stupid and obvious question, but I'm very new to
This might be a really stupid question, but I can't find any information regarding
This might be a stupid question but i would really appreciate any compact answer.
This might be a really easy question but I would like to grab the
This might be a really stupid question, but I'm curious. A ping of youtube.com
this might seem like a stupid question but I've Googled to no avail. I've
This might be a really stupid question and make you guys laugh. I've deployed
I feel like this might be really simple but I'm just not getting it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.