Jump to content

Call to undefined function


Fruddy

Recommended Posts

I get this error:

Fatal error: Call to undefined function: business_header() in /home/n/e/sv_newcomedynet/test.php on line 4

 

 

When i try to run this script:

<?
include('http://www.newcomedy.net/fns/output_fns.php');

business_header();

?>

 

The function:

<?

function business_header()
{
    ?>
    <body bgcolor="black">
     <table border="0" cellspacing="0" cellpadding="0" align="center">
      <tr>
       <td width="898" height="186" background="http://www.newcomedy.net/imgs/business_top.gif">
       </td>
      </tr>
     </table>
 <?
};

?>

 

 

I cant figure out what is wrong :/

Link to comment
Share on other sites

Do not use the full URL when including a local file, use the local file path:

<?php
include('fns/output_fns.php');
business_header();
?>

 

The same with the path of your image, use the relative path, so if you change hosts, it will still work:

<?php
function business_header()
{
    ?>
    <body bgcolor="black">
     <table border="0" cellspacing="0" cellpadding="0" align="center">
      <tr>
       <td width="898" height="186" background="imgs/business_top.gif">
       </td>
      </tr>
     </table>
 <?
};

?>

 

Ken

 

Link to comment
Share on other sites

The last sentence may explain it (from PHP manual - include)

If "URL fopen wrappers" are enabled in PHP (which they are in the default configuration), you can specify the file to be included using a URL (via HTTP or other supported wrapper - see Appendix L for a list of protocols) instead of a local pathname. If the target server interprets the target file as PHP code, variables may be passed to the included file using a URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file's variable scope; the script is actually being run on the remote server and the result is then being included into the local script.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

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.