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

  • Home
  • SEARCH
  • 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 6665431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:43:22+00:00 2026-05-26T02:43:22+00:00

The code below shows one email address as a output but I want to

  • 0

The code below shows one email address as a output but I want to get a list of all
email addresses (seperated by comma) of customer table. How can I get that?

<?php

    $SQLstring = "SELECT email FROM customers";
    $QueryResult = @mysqli_query($DBConnect, $SQLstring)
                   or die("<p>Unable to execute the query.</p>" .
                          "<p> Error code " . mysqli_errno($DBConnect) . ":" . mysqli_error                 ($DBConnect))."</p>";

    $NumRows = mysqli_num_rows($QueryResult);
    if ($NumRows == 0)
    {
        echo "<p>No email found.</p>";
    }

    else
    {
        for($i = 1; $i <= $NumRows; $i++)

        {
            $Row = mysqli_fetch_row($QueryResult);
            $email = stripslashes($Row[0]);
            echo $email;
        }
    }

?>
  • 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-26T02:43:22+00:00Added an answer on May 26, 2026 at 2:43 am

    This is mysqli not mysql you’re using so things work a little differently…

    Assuming you’ve created your mysqli connection with something like $DBConnect = new msqli( ... );

    It’s probably better to store the result before you manipulate it; try something like:

    $success = $DBConnect->real_query($SQLstring);
    if($success) {
      $result = $DBConnect->store_result();
      while($row = $result->fetch_array(MYSQLI_ASSOC)) {
        echo $row['email'] . "<br />\n"; //for debugging purposes
      }
    }
    
    $result->free();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The code below shows a line in different colors, but that's a lot of
The question is pretty simple, the code below shows the items in one category.
The code below works on one page, but not another page (the place it
ummm, probably a simple one... the code below only works with visible (show()) elements
The code below shows a sample that I've used recently to explain the different
The code below shows me (I think) that the for each loop is about
My PHP code below shows an image on browser as its original size 300x300.
The code below compiled in Debug configuration in VS2005 SP1 shows two messages with
I have the code below that hides and shows the navigational bar. It is
In the code shown below, how to get the values of multiselect box in

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.