Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a site which is developed in 2007. I have been using this website with no problem, but recently I am having a php error like below:

Fatal error: Call to undefined function getTitle() in comments.php error on line 3

$ptitle = htmlspecialchars(getTitle($row_cs['id'])); // line 3

This function is defined in funcs.php file.

Below is how I used the files with include;

index.php

include 'funcs.php'
...
...
...
include 'comments.php'

funcs.php

function getTitle($tid)
{
    $sql = mysql_query("select title from table where id = '".$tid."'");
    $title = mysql_fetch_row($sql);

    return $title[0];
}

I am calling getTitle() method in comments.php.
I am not directly including funcs.php in comments.php
Both files (funcs.php and comments.php) are included in index.php. And I was normally using a funcs.php method in comments.php file.

Why am I getting this error recently, is this a server configuration issue?

Thanks for your helps.

share|improve this question
1  
show the code where getTitle() is being called –  Deepanshu Sep 11 '13 at 11:10
    
you need to show the code for both where the function is defined and where the function is called –  zzlalani Sep 11 '13 at 11:13
    
Make up your mind, mate. Is your error "Call to undefined function" or is it "Call to a member function on non-object"? –  Maxim Kumpan Sep 11 '13 at 11:17
    
sorry for that, I have just tried to convert to an object and then call from this object. But this made no difference, just the error message changed. I have edited the question. –  tewoos Sep 11 '13 at 11:26
    
Can you please post the function declaration code AND the line where you call the function? –  Maxim Kumpan Sep 11 '13 at 11:31

1 Answer 1

Please use single quote to include the files.

include 'func.php';
include 'comments.php';
share|improve this answer
    
in php files, the quotes are included. this code was working, recently I am getting this error. nothing changed in codes. thanks. –  tewoos Sep 11 '13 at 12:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.