how to call function in php
<p>here is my code</p>

<pre><code>&lt;?php
function questSurvey()
{
    $eventId=$_REQUEST['eventId'];
    $mobileno=$_REQUEST['mobileno'];

    $regQry="select registration_profile_id from registration_profile_table where mobile_number='".$mobileno."' and event_id='".$eventId."'";
    $regIdArr = $this-&gt;db-&gt;readValues($regQry);

    $logQry="insert into log_table (event_id, reg_id_fk, activity_details, activity_date_time) values ('".$eventId."','".$regIdArr[0]['registration_profile_id']."','Survey: Submited a survey.',now())";
    $this-&gt;db-&gt;setQuery($logQry);

    $insertErr=0;
    if(get_magic_quotes_gpc())
        $answer=$_REQUEST['answer'];
    else
        $answer=addslashes($_REQUEST['answer']);

    $answerDtsArr=explode("&lt;qid&gt;",$answer);
    $Qry="select name, email_address from registration_profile_table where mobile_number='".$mobileno."' and event_id='".$eventId."'";
    $usrDtlArr = $this-&gt;db-&gt;readValues($Qry);
    $usrDtls="Answered By: ".$usrDtlArr[0]['name']."&lt;".$usrDtlArr[0]['email_address']."&gt;\r\n\r\n\r\n";
    $textcontent="";
    for ($i=0;$i&lt;count($answerDtsArr);$i++)
    {
        if ($answerDtsArr[$i]!='')
        {
            $questAnsArr=explode("&lt;ans&gt;",$answerDtsArr[$i]);
            if (count($questAnsArr)!=0)
            {
                $questId=$questAnsArr[0];
                $Qry="select question_detail from question_table where question_id='".$questId."'";
                $questDtlArr = $this-&gt;db-&gt;readValues($Qry);
                $textcontent.="\r\n\r\nQuestion: ".$questDtlArr[0]['question_detail']."\r\n";     
                $answerIdsArr=explode("~",$questAnsArr[1]);
                for ($j=0;$j&lt;count($answerIdsArr);$j++)
                {
                    if ($answerIdsArr[$j]!='')
                    {
                        $Qry="insert into response_table (question_id, event_id, speaker_id, mobile_number, answer_text, response_date_time, pinNo) values ('".$questId."','".$eventId."','','".$mobileno."','".$answerIdsArr[$j]."',now(),'')";
                        if(!$this-&gt;db-&gt;setQuery($Qry))
                            $insertErr=1;
                        else
                        {
                            $Qry="select answer_text from answer_table where answer_id='".$answerIdsArr[$j]."'";
                            $ansDtlArr = $this-&gt;db-&gt;readValues($Qry);
                            if (count($ansDtlArr)!=0)
                                $textcontent.="Answer: ".$ansDtlArr[0]['answer_text']."\r\n";     
                            else
                                $textcontent.="Answer: ".$answerIdsArr[$j]."\r\n";    
                        }
                    }
                }
            }
        }
    }

    if($insertErr==0)
    {
        $Qry="select event_ibm_survey_contact_email from event_table where event_id='".$eventId."'";
        $toemailArr = $this-&gt;db-&gt;readValues($Qry);
        $path="attachments/Survey-".$usrDtlArr[0]['name'].".txt";
        if (file_exists($path))
            $fileno=$this-&gt;checkFileExists($usrDtlArr[0]['name'],1);

        require("class/class.phpmailer.php");
        if ($fileno=='')
            $myFile = $path;
        else
            $myFile = "attachments/Survey-".$usrDtlArr[0]['name']."_".$fileno.".txt";

        $fh = fopen($myFile, 'w') or die("can't open file");
        $stringData = $textcontent.$usrDtls;
        fwrite($fh, $stringData);
        fclose($fh);

        $mail = new PHPMailer();

        $mail-&gt;IsSMTP(); // telling the class to use SMTP
        $mail-&gt;Host       = "mail.upfrontmedia.biz"; // SMTP server
        //$mail-&gt;SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
           // 1 = errors and messages
           // 2 = messages only
        $mail-&gt;SMTPAuth   = true;                  // enable SMTP authentication
        $mail-&gt;Host       = "***"; // sets the SMTP server
        $mail-&gt;Port       = 26;                    // set the SMTP port for the GMAIL server
        $mail-&gt;Username   = "***"; // SMTP account username
        $mail-&gt;Password   = "***";        // SMTP account password

        $mail-&gt;From = $email;
        $mail-&gt;FromName = $name;
        $mail-&gt;AddAddress($toemailArr[0]['event_ibm_survey_contact_email'], "MAIL-IBM");
        //$mail-&gt;AddBCC('ibm@upfrontmedia.biz', "IBM");
        $mail-&gt;AddCC('ibm@upfrontmedia.biz', "MAIL-IBM-Cc");
        $filename=$myFile;   
        if($filename!="")  
            $mail-&gt;AddAttachment($myFile);            

        $mail-&gt;WordWrap = 85;                                 // set word wrap to 50 characters
        $mail-&gt;IsHTML(true);                                  // set email format to HTML
        $mail-&gt;Subject = "[IBM Impact &amp; Innovate 2011] Answering Survey";
        $mail-&gt;Body    = "Please find the survey answers attachement";
        $mail-&gt;Send();
        $mail-&gt;ClearAddresses();

        $xml = "&lt;?xml version='1.0' ?&gt;
        &lt;result&gt;&lt;success&gt;Success&lt;/success&gt;&lt;/result&gt;";
    }else{
        $xml = "&lt;?xml version='1.0' ?&gt;
        &lt;result&gt;&lt;error&gt;Error&lt;/error&gt;&lt;/result&gt;";
    }

    echo $xml;
    exit;
}

$task =$_REQUEST['task'];
if ($task == 'getdata') 
{
    print questSurvey();
}
?&gt;
</code></pre>

<p>here i have a function ( getSurveyQuestions) when see the link in <a href="http://www.myappdemo.com/IBMEvents/api/class/Common.class.php?task=getdata&amp;eventId=4&amp;mobileno=9441838015" rel="nofollow">http://www.myappdemo.com/IBMEvents/api/class/Common.class.php?task=getdata&amp;eventId=4&amp;mobileno=9441838015</a> i get Fatal error: Call to undefined function getsurveyquestions() in /home/myappdemo/myappdemo.com/IBMEvents/api/class/Common.class.php on line 1181</p>
