Sadu Posted August 21, 2007 Share Posted August 21, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/66052-solved-if-problem/ Share on other sites More sharing options...
Sadu Posted August 21, 2007 Author Share Posted August 21, 2007 Any1 know how to make it? Please help me Quote Link to comment https://forums.phpfreaks.com/topic/66052-solved-if-problem/#findComment-330384 Share on other sites More sharing options...
Barand Posted August 21, 2007 Share Posted August 21, 2007 Store your output into a string instead of echoing. Then <?php echo str_replace("Broń Radom" , "<B>Broń Radom</B>" , $str); Quote Link to comment https://forums.phpfreaks.com/topic/66052-solved-if-problem/#findComment-330412 Share on other sites More sharing options...
Sadu Posted August 22, 2007 Author Share Posted August 22, 2007 Thank you very much its working! Quote Link to comment https://forums.phpfreaks.com/topic/66052-solved-if-problem/#findComment-330731 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.