Jump to content

Call to undefined function in include file


chilluk

Recommended Posts

I am moving a site from one server to another - on the old server all is well in terms of functionality of the site.

 

In a file which I "include" in every page is a custom function to format a price. I then call this function PriceFormat() in the main body of pages that include the file where the function resides.

 

As I say on the old server that works OK, but on the new it fails with the following error :

 

Fatal error: Call to undefined function PriceFormat() in D:\wwwroot\Domain\httpdocs\default.php on line 172

 

Is it a config issue I have missed? I have tried to go through php.ini but can't see anything glaring.

 

Cheers.

 

Chris.

Function in the include is as follows - this is just inside the file :

 

function PriceFormat($price){
  $price = str_replace(",","",$price);
  if($price==0)
  {
  $format = "Price on application";
  }else{  
  if(isset($_COOKIE["curr"]["rate"]))
  {
    $format = $_COOKIE["curr"]["pref"] . number_format($price,2);
  }else{
    $format = "£" . number_format($price,2);
  }}
  return $format;
}

 

In the default.php I have :

 

<?php include "bartop.php" ?>

 

and then :

 

echo "<tr><td class=BlackSmall><b>RRP : " . PriceFormat($rrp) . "</b><br>";			

 

The include file does also have some html markup in it which is being displayed so it's finding the file, not recognising the function.

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.