Jump to content

Call to undefined function


insei

Recommended Posts

Hello, im trying to use a function inside an echo but i get error. Cant seem to figure out the error.

 

The code:

 

<?php include("functions.php"); ?>

 

<div id="center-box-wrapper">

<h2 class="box"><p>1v1 Offline Rankings</p></h2>

<div id="center-box-main-container-padding">

 

<table class="standings_whole">

<tr>

<td width='39px'>Pos</td>

<td width='43px'>Rank</td>

<td width='29px'>Nat</td>

<td width='106px'>Character</td>

<td width='159px'>Username</td>

<td width='40px'>Points</td>

<td width='71px'>Statistics</td>

<td width='67px'>Win Ratio</td>

</tr>

<?php

 

$results = mysql_query("SELECT * FROM ladder_users");

 

$pos = 0;

while($row = mysql_fetch_array($results)) {

 

$pos += 1;

echo "

<tr>

<td width='39px'>#".$pos."</td>

<td width='43px'><img class='standings' src='images/ranks/".$row['Rank'].".jpg' border='0' /></td>

<td width='29px'><img class='standings' width='25px' height='17px' src='images/flags/".$row['Nationality'].".gif' border='0' alt='".$row['Nationality']."' /></td>

<td width='106px'><img class='standings' src='images/characters/".$row['Mchar'].".jpg' border='0' /></td>

<td width='159px'>".$row['Username']."</td>

<td width='40px'>".$row['Points']."</td>

<td width='71px'>".$row['Win']." - ".$row['Loss']."</td>

<td width='67px'>".win_ratio($row['Win'],$row['Loss'])."%</td>

</tr>

";

 

 

}

 

?>

 

</table>

</div>

<div id="center-box-bottom">

</div>

</div>

 

This is whats inside the functions.php :

 

function win_ratio($win,$loss) {

 

if ($loss == 0) {

return 100;

}

 

else if ($win == 0) {

return 0;

}

 

else {

$ratio = (($win/($win+$loss))*100);

return round($ratio, 2);

}

}

 

Link to comment
https://forums.phpfreaks.com/topic/188140-call-to-undefined-function/
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.