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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:52:53+00:00 2026-05-24T02:52:53+00:00

I have a table as shown below The output from said table Green, is

  • 0

I have a table as shown below

The output from said table
Green, is where a winner has been announced, whereas yellow means they have submitted a report, but a winner hasn’t been decided yet. (winner field not populated)

        $roundBound = Array();
        $query = "SELECT MIN(id), MAX(id) FROM $tablename GROUP BY round";
        if($result = $Login->mysqli->query($query)) {
            while ($row = $result->fetch_row()) {
                $roundBound[] = $row[0];
                $roundBound[] = $row[1];
            }
        }
        for($i = 0; $i < count($roundBound); $i = $i + 2) {
            $match = 0;
            for($j = $roundBound[$i]; $j < $roundBound[$i + 1]; $j = $j + 2) {
                $id1 = $j;
                $id2 = $j+1;
                $query = "SELECT t1.winner, t2.winner FROM $tablename as t1, $tablename as t2 WHERE t1.id=$id1 AND t2.id=$id2";
                $result = $Login->mysqli->query($query);
                $row = $result->fetch_row();
                $win1 = $row[0];
                $win2 = $row[1];
                if (isset($win1) && isset($win2)) {
                    if (isset($roundBound[$i + 2])) {
                        $id = $roundBound[$i + 2] + $match;
                        $query = "UPDATE $tablename SET
                            username = '$win1',
                            username2 = '$win2'
                            WHERE id = $id";
                        $Login->mysqli->query($query);
                    } else {
                        //Tourneydonneee yeeee
                    }
                }
                $match++;
            }
        }

Does anyone have a improvement, or an all-around different idea? This will be running quite often and could be potentially running on large record sets, so optimization would also be welcome.

  • 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-24T02:52:53+00:00Added an answer on May 24, 2026 at 2:52 am

    as far as i understand you problem, i can suggest you to try

    for ($i = 0; $i < count($arr); $i = $i + 2) {
        $win1 = mysql_query("SELECT winner FROM tableName WHERE id=".(int)$i);
        $win2 = mysql_query("SELECT winner FROM tableName WHERE id=".(int)$i+1);
        $qry = "INSERT INTO tableName SET 
                              username = $win1,
                              username2 =$win2,
                              ....";
        mysql_query($qry);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have sales table data as shown below Sales Table Data http://lh5.ggpht.com/_KT7tmVVBHFM/TCryAax1JlI/AAAAAAAAAFk/zahMq4RoOuw/s144/Sales.png I want
I have two tables as shown below The master Table ID keyword_tags ----------- ---------------------------------------------
I have a table as shown below. When I click a table cell(only cells
We have a configuration table as shown below that stores the start time and
Hello I have table name FriendsData that contains duplicate records as shown below fID
I have table inside a div tab. The table has 40 rows in it
I have table rows of data in html being filled from a CGI application.
In SQL server 2008, I have below table Score. I want to show Score1
I have a table.From that table i am selecting rows Based on the key
I have two MySQL tables named 'nodes' and 'joinTable' like shown below. I need

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.