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 8261435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:24:25+00:00 2026-06-08T03:24:25+00:00

Can some one please explain why this simple form doesnt work? The problem is

  • 0

Can some one please explain why this simple form doesnt work?

The problem is that when I use mysql_real_escape_string() the result are nothing, when I remove it it works perfectly can you please see whats wrong here?

This is the full simple code,

<?php

// Loop the post fields
$postFields = array('username', 'password', 'checkSubmission');
$postArray = array();
foreach($postFields as $postVal){
    $postArray[$postVal] = mysql_real_escape_string($_POST[$postVal]);
}
print_r($postArray);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Signin</title>
<head>
</head>
<body><? echo $error;?>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post" id="signinForm">
    Username: <input type="text" name="username" value="" />
    Password: <input type="password" name="password" value="" />
    <input type="hidden" name="checkSubmission" value="1" />
    <input type="submit" name="Submit" value="Signin" />
</form>
</body>
</html>

EDIT:

The print_r() is empty when I use mysql_real_escape_string()

Array ( [username] => [password] => [checkSubmission] => )

And this is the print_r() without mysql_real_escape_string()

Array ( [username] => thre[password] => werr[checkSubmission] => 1)

Thank you for you help

  • 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-06-08T03:24:27+00:00Added an answer on June 8, 2026 at 3:24 am

    mysql_real_escape_string() requires an active database connection.

    From the php manual:

    A MySQL connection is required before using mysql_real_escape_string()
    otherwise an error of level E_WARNING is generated, and FALSE is
    returned. If link_identifier isn’t defined, the last MySQL connection
    is used.

    http://php.net/manual/en/function.mysql-real-escape-string.php

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

Sidebar

Related Questions

Can some one please explain why this loop never 'breaks' and goes on forever
Could someone please help explain why I can't get this to work? I properly
Please can some one explain the javacv method for the pyrDown() method. I'm trying
Can some one please help explain why when I block and continue observer's onNext
Can someone please explain this phenomenon? I am using Mojarra 2.1.6 - Glassfish 3.1.2.
Can someone please explain to me how this responsive approach works? This was done
Can someone please explain why I'm getting this error Type mismatch: cannot convert from
I have a feeling this XML is not valid, can someone please explain why?
Can someone please explain why ?___SID=U is appearing in some Magento URLs on my
Can someone please explain to me, why every time I use the FlowLayout Layout

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.