Jump to content

[SOLVED] if? problem


Sadu

Recommended Posts

Hello,

im newbie in php, im studying it now... and i have some problem..

 

this is my code:

 

<?php
function pojedynek($team, $status) {

if($status=='0') {
$query = "SELECT * FROM spotkania WHERE (s_t1 = '$team' or s_t2 = '$team') and s_status = '0' ORDER BY s_kolejka DESC LIMIT 0,1";
} else {
$query = "SELECT * FROM spotkania WHERE (s_t1 = '$team' or s_t2 = '$team') and s_status > '0' ORDER BY s_kolejka DESC LIMIT 0,1";
}

$result = mysql_query($query) or die(mysql_error());
$db = mysql_fetch_array($result);
$select = mysql_query("SELECT * FROM druzyna WHERE d_id = '$db[s_t1]'") or die(mysql_error());
$vs = "<td style=\"width: 50px;\"><img src=\"images/index_22.gif\" alt=\"\" width=\"50\" /></td>";
$db2 = mysql_fetch_array($select);
$select2 = mysql_query("SELECT * FROM druzyna WHERE d_id = '$db[s_t2]'") or die(mysql_error());
$db3 = mysql_fetch_array($select2);
$float['1'] = "left";
$float['2'] = "right";
echo "<table border='0'><tr>";
if($db2[d_nazwa] == "Broń Radom" || $db3[d_nazwa] == "Broń Radom") {
echo "<td style=\"width: 70px;\"><img src=\"$db2[d_logo]\" width=\"50\" alt=\"$db2[d_nazwa]\" /><br /><span style=\"color: #0090FF; font-size: small\"><B>$db2[d_nazwa]</B></span></td>$vs";
echo "<td style=\"width: 70px;\"><img src=\"$db3[d_logo]\" width=\"50\" alt=\"$db3[d_nazwa]\" /><br /><span style=\"color: #0090FF; font-size: small\">$db3[d_nazwa]</span></td>";
} else {
echo "<td style=\"width: 70px;\"><img src=\"$db2[d_logo]\" width=\"50\" alt=\"$db2[d_nazwa]\" /><br /><span style=\"color: #0090FF; font-size: small\">$db2[d_nazwa]</span></td>$vs";
echo "<td style=\"width: 70px;\"><img src=\"$db3[d_logo]\" width=\"50\" alt=\"$db3[d_nazwa]\" /><br /><span style=\"color: #0090FF; font-size: small\"><B>$db3[d_nazwa]</B></span></td>";
}

while($db2 = mysql_fetch_array($select)) {
$d++;
  echo "<td style=\"width: 70px;\"><img src=\"$db2[d_logo]\" width=\"50\" alt=\"\" /><br /><span style=\"color: #0090FF; font-size: small\">$db2[d_nazwa]</span></td>$vs";
  $vs = "";
}
echo "</tr><tr><td colspan='3'>".if_relacja($db[s_id])."</td></tr></table>";
}

 

And it shows me:

 

 

    Last match:

Uzdrowisko - Broń Radom

 

    Next match:

 

Broń Radom - Kapielisko

 

 

 

But this is not good. When it is "Broń Radom"  it must be Broń Radom, like this:

 

      Last match:

Uzdrowisko - Broń Radom

 

      Next match:

 

Broń Radom - Kapielisko

 

 

What should i change in this code? Whats bad?

Im sorry for my bad eng :( Im study it too.

 

Thank you for help.

Link to comment
https://forums.phpfreaks.com/topic/66052-solved-if-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.