Jump to content

yandoo

Members
  • Posts

    472
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

yandoo's Achievements

Advanced Member

Advanced Member (4/5)

1

Reputation

  1. It was missing html > on the span. OK so I guess the logics OK. Thank you.
  2. Hello I was hoping for some help with my if statement logic as I'm getting strange results and wonder if I am doing something (or lots) totally wrong. I have a mysql query that pulls 3 planets(Anoat, Sullust, Umbara) from a table, the results are in a while loop and the 3 if else statements are within it. The idea is that by using the if statements I can assign css classes to display the planet names in different positions and style. This seemed to be working fine until I noticed a problem and now it's made me wonder if I'm going about this totally wrong. The issue is that if the if condition (name, faction id and identified) all are met, not only is the correct output name displayed but the next planet name displays with it. For example SullustUmbra.I have no idea why it would do that as umbara has is own if else statement. If you wouldn't mind putting me out my misery I'd be very grateful. Thank you Yan. $query_planet = "SELECT * FROM planet "; $planet = mysql_query($query_planet, $conn) or die(mysql_error()); $totalRows_planet = mysql_num_rows($planet); while ($row_planet = mysql_fetch_array($planet)) { //Anoat if (($row_planet['name'] == "Anoat") && ($row_planet['factionid'] == $_SESSION['MM_Username']) && ($row_planet['factionid'] == '1')){ echo '<a href="" class="anoat green">Anoat</a>'; } else if (($row_planet['name'] == "Anoat") && ($row_planet['factionid'] == $_SESSION['MM_Username']) && ($row_planet['factionid'] == '2')){ echo '<a href="" class="anoat red">Anoat</a>'; } else if (($row_planet['name'] == "Anoat") && ($row_planet['factionid'] != $_SESSION['MM_Username']) && ($row_planet['identified'] == '1') && ($row_planet['factionid'] == '2' )) { echo '<span class="anoat red">Anoat</span>'; } else if (($row_planet['name'] == "Anoat") && ($row_planet['factionid'] != $_SESSION['MM_Username']) && ($row_planet['identified'] == '1') && ($row_planet['factionid'] == '1' )) { echo '<span class="anoat green">Anoat</span>'; } else if (($row_planet['name'] == "Anoat") && ($row_planet['factionid'] != $_SESSION['MM_Username']) && ($row_planet['identified'] == '0')) { echo '<span class="Anoat">Anoat</span>'; } else if (($row_planet['name'] == "Anoat") && ($row_planet['factionid'] == '0')) { echo '<span class="anoat">Anoat</span>'; } //Sullust if (($row_planet['name'] == "Sullust") && ($row_planet['factionid'] == $_SESSION['MM_Username']) && ($row_planet['factionid'] == '1')){ echo '<a href="" class="Sullust green">Sullust</a>'; } else if (($row_planet['name'] == "Sullust") && ($row_planet['factionid'] == $_SESSION['MM_Username']) && ($row_planet['factionid'] == '2')){ echo '<a href="" class="Sullust red">Sullust</a>'; } else if (($row_planet['name'] == "Sullust") && ($row_planet['factionid'] != $_SESSION['MM_Username']) && ($row_planet['identified'] == '1') && ($row_planet['factionid'] == '2' )) { echo '<span class="Sullust red">Sullust</span'; } else if (($row_planet['name'] == "Sullust") && ($row_planet['factionid'] != $_SESSION['MM_Username']) && ($row_planet['identified'] == '1') && ($row_planet['factionid'] == '1' )) { echo '<span class="Sullust green">Sullust</span>'; } else if (($row_planet['name'] == "Sullust") && ($row_planet['factionid'] != $_SESSION['MM_Username']) && ($row_planet['identified'] == '0')) { echo '<span class="Sullust">Sullust</span>'; } else if (($row_planet['name'] == "Sullust") && ($row_planet['factionid'] == '0')) { echo '<span class="Sullust">Sullust</span>'; } //Umbara if (($row_planet['name'] == "Umbara") && ($row_planet['factionid'] == $_SESSION['MM_Username']) && ($row_planet['factionid'] == '1')){ echo '<a href="" class="Umbara green">Umbara</a>'; } else if (($row_planet['name'] == "Umbara") && ($row_planet['factionid'] == $_SESSION['MM_Username']) && ($row_planet['factionid'] == '2')){ echo '<a href="" class="umbara red">Umbara</a>'; } else if (($row_planet['name'] == "Umbara") && ($row_planet['factionid'] != $_SESSION['MM_Username']) && ($row_planet['identified'] == '1') && ($row_planet['factionid'] == '2' )) { echo '<span class="Umbara red">Umbara</span>'; } else if (($row_planet['name'] == "Umbara") && ($row_planet['factionid'] != $_SESSION['MM_Username']) && ($row_planet['identified'] == '1') && ($row_planet['factionid'] == '1' )) { echo '<span class="Umbara green">Umbara</span>'; } else if (($row_planet['name'] == "Umbara") && ($row_planet['factionid'] != $_SESSION['MM_Username']) && ($row_planet['identified'] == '0')) { echo '<span class="Umbara">Umbara</span>'; } elseif (($row_planet['name'] == "Umbara") && ($row_planet['factionid'] == '0')) { echo '<span class="umbara">Umbara</span>'; } }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.