Jump to content


Photo

Calling function from another file


  • Please log in to reply
3 replies to this topic

#1 chai

chai
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 24 May 2006 - 04:23 PM

Hi,

I am trying to write often-used code snippets such as add, edit,delete function and place them in
functions.php

So, whenever I need to use them, I can just call then up and pass parameters to them.

I am able to call a function that is inside the same page it is called.

But, how do I call a function that is in another file.

I've read about the include() function, but it doen't perform what I wanted.

Any ideas?



#2 chrisbcats

chrisbcats
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 24 May 2006 - 04:43 PM

<?php
require 'file_name.php';
?>
<html>

<head>
<body>
......
<?php

function_name();

?>

.........


#3 micah1701

micah1701
  • Members
  • PipPipPip
  • Advanced Member
  • 613 posts
  • LocationEllington, CT USA

Posted 24 May 2006 - 04:44 PM

include('functionScript.php');

//will include the function. then just call the function.

myFunction();

//maybe you can post some code
//so we can see why this isn't working.
//it should
"Confidence in the face of risk."

#4 chai

chai
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 25 May 2006 - 05:46 PM

It is working now..
I was messing with the .ini file..don't know whether if this the cause :P

I am rather stuck in the session object though
going through tutorial as i am writing this..

Thanks.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users