Page 1 of 1

Call to undefined function

Posted: Mon Jan 11, 2010 9:58 pm
by insei
Hello, i cant seem to find the error in this code..

http://www.xgs-gaming.com/tlt/files/lad ... /index.php



<?php

include("functions.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>
";


}

?>


This is whats inside 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);
}
}

Re: Call to undefined function

Posted: Mon Jan 11, 2010 10:08 pm
by SimpleManWeb
Change your include (functions.php) to require (functions.php). I bet you will find that the file is not being included. I couldn't find any errors in your code, so it has to be that it isn't getting the file correctly.

Re: Call to undefined function

Posted: Mon Jan 11, 2010 10:10 pm
by requinix
insei wrote:Hello, i cant seem to find the error in this code..
And you want us to do it for you? You going to give us something to start from?

Re: Call to undefined function

Posted: Mon Jan 11, 2010 10:15 pm
by insei
tasairis wrote:
insei wrote:Hello, i cant seem to find the error in this code..
And you want us to do it for you? You going to give us something to start from?
im sorry my bad... I was stupid enough to forget the php tags inside the functions.php.

Thanks alot for the replies, really apriciate it.