Jump to content
MakeWebGames

Recommended Posts

Posted

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

Posted

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

Posted

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

Posted

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

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...