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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:20:47+00:00 2026-05-30T15:20:47+00:00

Although the item is successfully added to the database, I’m not sure that I’m

  • 0

Although the item is successfully added to the database, I’m not sure that I’m executing the mysql_real_escape_string() function correctly and, thus, getting the error. Any help is appreciated.

Success!

Warning: array_map() [function.array-map]: Argument #2 should be an array in /home/site4/public_html/lab/mailing_list_dev_1-0/mailing_list_add.php on line 32

Thanks for signing up!

Here’s the code in question…

<?php
// connects the database access information this file
include("mailing_list_include.php");

// the following code relates to mailing list signups only
if (($_POST) && ($_POST["action"] == "sub")) {

if ($_POST["email"] == "") {
        header("Location: mailing_list_add.php");
        exit;
    } else {
        // connect to database
        doDB();
    
        // filtering out anything that isn't an email address
        if ( filter_var(($_POST["email"]), FILTER_VALIDATE_EMAIL)  == TRUE) {
            echo 'Success!';
        } else {
            echo 'Invalid Email Address';
            exit;
        }
        
        // check that the email is in the database
        emailChecker($_POST["email"]);
    
        // get number of results and do action
        if (mysqli_num_rows($check_res) < 1) {
            // free result
            mysqli_free_result($check_res); 
        
            // cleans all input variables at once
            $email = array_map("mysqli_real_escape_string", ($_POST["email"]));
            
            // add record
            $add_sql =  "INSERT INTO subscribers (email)
                        VALUES('".$_POST["email"]."')";
            $add_res =  mysqli_query($mysqli, $add_sql)
                        or die(mysqli_error($mysqli));
            $display_block = "<p>Thanks for signing up!</p>";
        
            // close connection to mysql
            mysqli_close($mysqli);
        } else {
            // print failure message
            $display_block = "You're email address, ".$_POST["email"].", is already subscribed.";
    }
}
}

?>
<html>
<?php echo "$display_block";?>
</html>
  • 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-30T15:20:48+00:00Added an answer on May 30, 2026 at 3:20 pm

    You’re treating $_POST['email'] as an array, which it probably ins’t.

    If you only intended to escape email, do

    $email = mysqli_real_escape_string($dbConn, $_POST['email']);
    

    Then in your INSERT statement, use the escaped $email instead of $_POST['email']

    $add_sql =  "INSERT INTO subscribers (email) VALUES('$email')";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem that confuses my users, being that although an item is
Although it runs correctly, the following results in the aforementioned compiler warning: return ((item
This query works: item = db.GqlQuery(SELECT * FROM Item WHERE CSIN = 13)[0] although
I want a ListBox full of items. Although, each item should have a different
Although I do understand the serious implications of playing with this function (or at
Although my question might seem abstract I hope it's not. Suppose I develop an
I am trying to display a single item (not contained in a collection) using
I have done this successfully with an UPDATE statement before but not a REPLACE.
I'm having trouble finding the easiest path to an item using jQuery (although the
I have the problem: I can not add new item to the same combobox

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.