I am very new to php. I have written my functions in separate file and included that file in my main .php file. Now when I get responseText ( I am working with Ajax) whole of the included file gets echoed i.e. code. why is this behavior of php and how should i make sure that php only echos what i tell it to.
Any help would be appriciated.
Php echos whole included file.
Moderator: General Moderators
-
jewelthief
- Forum Newbie
- Posts: 13
- Joined: Sat Aug 29, 2009 1:46 am
- greyhoundcode
- Forum Regular
- Posts: 613
- Joined: Mon Feb 11, 2008 4:22 am
Re: Php echos whole included file.
Would be appreciated if you could post some code? Might provide a fuller understanding of the particular problem you are facing.
-
jewelthief
- Forum Newbie
- Posts: 13
- Joined: Sat Aug 29, 2009 1:46 am
Re: Php echos whole included file.
functions.php file
main.php file
It is a chuck of code. When i make alert()of responseText in javascript, I get whole of the functions.php file as responseText.
Code: Select all
function UdateAtServer($xmlDoc,$i)
{
$num_of_subTasks = $xmlDoc->getElementsByTagName("abc")->item($i).length;
}Code: Select all
require_once("functions.php");
if($num_of_tasks > 0)
{
$con = mysql_connect("localhost:3306","root","");
if($con)
{
if( mysql_select_db("fgh",$con))
{
for($i =0;$i <$num_of_tasks;$i++)
{
if($xmlDoc->getElementsByTagName("abc")->item($i)->hasAttribute("new"))
{
UdateAtServer($xmlDoc,$i);
}
}
}
}