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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:48:09+00:00 2026-06-10T06:48:09+00:00

i have this on my mysql database email have 5 value user have 15

  • 0

i have this on my mysql database

email have 5 value
user have 15 value

how can i loop the email with something like this

email          user
ya1@yahoo.com  user1
ya2@yahoo.com  user2
ya3@yahoo.com  user3
ya4@yahoo.com  user4
ya5@yahoo.com  user5
ya1@yahoo.com  user6
ya2@yahoo.com  user7
ya3@yahoo.com  user8
--------------------
and so on....

using the php foreach…
something like when the users loop the email value will loop also and when it reach the end of the value of the email the email will start again to the first ya1@yahoo.com

is it possible to work on this on foreach or do it as a while?

  • 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-10T06:48:11+00:00Added an answer on June 10, 2026 at 6:48 am
    $e = array('email1', 'email2' /* , more email */);
    $u = array('user1', 'user2', 'user3' /* , more users */);
    
    $total_e = count($e);
    $total_u = count($u);
    $total   = $total_e * $total_u;
    
    $counting_e  = 0;
    $counting_u  = 0;
    
    for ($i = 0; $i < $total; $i ++ )
    {
        echo nl2br($e[$counting_e ++] . " => " . $u[$counting_u ++] . "\n");
    
        if ($counting_e == $total_e)
            $counting_e = 0;
        if ($counting_u == $total_u)
            $counting_u = 0;
    }
    

    Test: http://codepad.org/R5PpAKQW

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

Sidebar

Related Questions

I have a MySQL database table called Participant that looks something like this: (idParticipant)
I have this strings saved in my mysql database in format like: /uploads/attachments/18/105/WordPress_3_Cookbook.pdf Now,
I have mysql database like this id | code 1 | bok-1 2 |
I have a mysql database that looks like this: |id | city | created
I have multiple tables in a MySQL database. Lets say they look like this:
I have user table having fields gender and first name like this.. The value
In mysql database i have this column called: Name: Date Type: datetime I have
Suppose I am building an app using current mysql database tables. I have this
I'm translating an old database SyBase to MySQL and I have this DDL Query:
I am writing an email application that interfaces with a MySQL database. I have

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.