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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:13:59+00:00 2026-05-26T07:13:59+00:00

I have a php function getContactList() : $res = getContactList(trim($_POST[‘username’]), trim($_POST[‘password’])); which returns this

  • 0

I have a php function getContactList():

$res = getContactList(trim($_POST['username']), trim($_POST['password']));

which returns this array:

$contactList[] = array('name' => $name, 'email' =>$email);

I need to store the contents of this array into a MySQL database.
Somehow can i store the entire contents of the array in the database at one go ??
The number of array items will be more than 500 at each go , so i wanna avoid the usual looping practice and calling the “Insert” statement in the for loop as this will need a long time to execute.

Note: I need to store the results in separate columns – One for Name and another for Email. With 500 items in that array I need to have 500 rows inserted – one Name-Email pair per row.

  • 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-26T07:14:00+00:00Added an answer on May 26, 2026 at 7:14 am
    $values = array();
    // the above array stores strings such as:
    // ('username', 'user@domain.com')
    // ('o\'brien', 'baaz@domain.com')
    // etc
    foreach($contactList as $i => $contact) {
        $values[] = sprintf(
            "('%s', '%s')",
            mysql_real_escape_string($contact['name'], $an_open_mysql_connection_identifier),
            mysql_real_escape_string($contact['email'], $an_open_mysql_connection_identifier)
        );
    }
    $query = sprintf(
        "INSERT INTO that_table(name, email) VALUES %s",
        implode(",", $values)
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP function which returns an array : function lire( $id) {
I have a PHP function that returns an array. This is the output of
i have a php function which returns a random json encoded color <?php function
i have php function that parses a xml url and gives me an array.this
I have a PHP function that returns an array. What is the best way
I have this php function, which I want to convert to javascript function, but
I have this PHP function : if(($_POST['id']==pm_read) && (isset($_POST['pm_id'])) && (ctype_digit($_POST['pm_id'])) && (isset($_SESSION['nickname']))) {
I have a PHP function which populates a multi-dimensional array $client->getResponse() I want to
I have a php function which is called by a jquery function. This jquery
I have a PHP function that returns something: function myfunction() { $array = array('one',

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.