hunter Posted February 8, 2007 Share Posted February 8, 2007 Fatal error: Cannot redeclare money_formatter() (previously declared in /home/deeznuts/public_html/global_func.php:8) in /home/public_html/global_func.php on line 8 What cause this kind of error Thanks Quote Link to comment Share on other sites More sharing options...
Decepti0n Posted February 8, 2007 Share Posted February 8, 2007 Re: Can someone please help Fatal error: Cannot redeclare money_formatter() so maybe you declared it once, and RE-declared it which is apparently bad, according to that error to declare a function we have: function function_name() maaaaaaaaaaaaybe, judging by the error, and the re bit, you did that twice i thought error messages gave a good amount of info, guess not Quote Link to comment Share on other sites More sharing options...
UCC Posted February 8, 2007 Share Posted February 8, 2007 Re: Can someone please help most likey it's already declared in the global_func file and you're trying to re-declare the same function name Quote Link to comment Share on other sites More sharing options...
hunter Posted February 8, 2007 Author Share Posted February 8, 2007 Re: Can someone please help This i changed in the global.php <?php session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['moneys']); $cm=money_formatter($ir['crystals']); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); money_formatter($muny,$symb='$') { $moneys=""; $muny= (string) $muny; if (strlen($muny) <= 3) { return $symb.$muny; } $dun=0; for($i=strlen($muny);$i>0;$i-=1) { if ($dun % 3 == 0 && $dun > 0) { $moneys=",".$moneys; } $dun+=1; $moneys=$muny[$i-1].$moneys; } return $symb.$moneys; } This is the error Fatal error: Cannot redeclare money_formatter() (previously declared in /home/deeznuts/public_html/global_func.php:8) in /home/public_html/global_func.php on line 8 thanks again for any help you can give Quote Link to comment Share on other sites More sharing options...
Arson Posted February 9, 2007 Share Posted February 9, 2007 Re: Can someone please help if its declared ONCE in GLOBAL func then you dont need to declare it on the apge you are using it on...just put $whatever=money_formatter($whatever); dont copy the whole function again Quote Link to comment 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.