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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:08:19+00:00 2026-06-15T23:08:19+00:00

I have this bit of code within a while loop. $hometeamwin=(lose,win) so with that

  • 0

I have this bit of code within a while loop.

$hometeamwin=(lose,win) so with that bit of code above it is printing “winlose”

If there’s occurrences of ‘lose’ within $hometeamwin I’d like it to print “lose” (but only once!)

if there’s no occurrences of ‘lose’ print ‘win’ (but only once!)

  • 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-15T23:08:20+00:00Added an answer on June 15, 2026 at 11:08 pm

    If I understand your problem (I’m not positive I do) you want to look at all of the bets and if any of them resulted in a loss, then after you list them all, you want to display win or loss depending on if there was a loss among the results. I copied your code and added 3 lines marked with #ADDED. Add those three lines to acheive what I described.

    if($num_rows) {
        $wonBet = true;  #ADDED
        while ($row = mysql_fetch_assoc($result)) {
            echo "<tr>";
            if(!$row["ht_score"]) {
                $halftime = "-";
            } else {
                $halftime = $row["ht_score"];
            }
            if(!$row["ft_score"]) {
                $fulltime = "-";
            } else {
                $fulltime = $row["ft_score"];
            }
    
            echo "<td>" . $row["home_team"] . "</td>" . "<td>" . " vs " . "</td>" . "<td>" . $row["away_team"] . "</td>" . "<td>" . $halftime . "</td>" . "<td>" . $fulltime . "</td>";
    
            $value = $fulltime;
            $apart = explode('-',$value); 
            if($apart[0] > $apart[1] && $row["home_id"]==$row["winningid"]) {
                $hometeamwin = "Win";
            } else if($apart[0] < $apart[1] && $row["away_id"]==$row["winningid"]) {
                $hometeamwin = "Win"; 
            } else if($apart[0] == $apart[1] && !$row["winningid"]) {
                $hometeamwin = "Win"; 
            } else { 
                $hometeamwin = "lose";    
            }
    
            if($fulltime!=$row["ft_score"]) {
                 $hometeamwin = "";
            }
            if($hometeamwin == "lose"){  #ADDED
                $wonBet = false;         #ADDED
            }                            #ADDED
            echo "<td>" . $hometeamwin . "</td>";
            echo "</tr>";
        }
    
        echo ($wonBet) ? "You won bet" : "You lost bet";  #ADDED
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bit of sample code that is throwing this warning: main.c: In
I have this bit of code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data;
i have this bit of code, it limits the Li's to 15 of them
I have this bit of code, public static List<string> GetSentencesFromWords(List<string> words, string fileContents) {
So I have this bit of code for x in range(x1,x2): for y in
ok i got this problem. i have this routes: (code bit change) File:/home/dotcloud/current/config/routes.js exports.routes
I use this bit of code to feed some data i have parsed from
its a little bit hard to understand. in the header.php i have this code:
I have the following bit of code, simply: $(function() { $('a.add-photos-link').live('click', function(e) { $(this).colorbox({
I have a bit of php code like this: $test = <!--my comment goes

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.