chilluk Posted May 8, 2008 Share Posted May 8, 2008 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. Link to comment https://forums.phpfreaks.com/topic/104704-call-to-undefined-function-in-include-file/ Share on other sites More sharing options...
blackcell Posted May 8, 2008 Share Posted May 8, 2008 Can you post some code from default.php and the include? Link to comment https://forums.phpfreaks.com/topic/104704-call-to-undefined-function-in-include-file/#findComment-535855 Share on other sites More sharing options...
chilluk Posted May 8, 2008 Author Share Posted May 8, 2008 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. Link to comment https://forums.phpfreaks.com/topic/104704-call-to-undefined-function-in-include-file/#findComment-535860 Share on other sites More sharing options...
PFMaBiSmAd Posted May 8, 2008 Share Posted May 8, 2008 My guess is short open tags <? are being used in the include file. You actually need to post the include file to get help with what it is doing that is causing the function to not be defined. Link to comment https://forums.phpfreaks.com/topic/104704-call-to-undefined-function-in-include-file/#findComment-535868 Share on other sites More sharing options...
chilluk Posted May 8, 2008 Author Share Posted May 8, 2008 Ah - spot on! Many Many Thanks! Link to comment https://forums.phpfreaks.com/topic/104704-call-to-undefined-function-in-include-file/#findComment-535879 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.