...

View Full Version : Iam getting an error un defined function load()



bhagyaa2ze
06-28-2007, 07:29 AM
Hi, I am getting an error when i uploading the Xml document.

Iam getting an error is that "Fatal error: Call to undefined function: load() "

The following is the code:

<?
ob_start();

$id=$_REQUEST['teamid'];
echo $id;
?>
<?php
$data = array();

function add_person( $teamname,$points)
{
global $data;
$con=mysql_connect("host name","root","pass");
mysql_select_db("database name");
//echo $first;
//echo $middle;



$sql=mysql_query("insert into teamodi(teamname,points) values('$teamname','$points')") or die(mysql_error());
//$sql=mysql_query("insert into names(first,middle,last,email) values('$first','$midddle','$last','$email)") or die(mysql_error());
$data []= array(
'teamname' => $teamname,
'points' => $points,
);
}

if ( $_FILES['file']['tmp_name'] )
{
//$dom = new DOMDocument();
//$dom->load($_FILES['file']['tmp_name']);
$dom = DOMDocument::load( $_FILES['file']['tmp_name'] );
$rows = $dom->getElementsByTagName( 'Row' );
$first_row = true;
foreach ($rows as $row)
{
if ( !$first_row )
{
$teamname = "";
$points = "";


$index = 1;
$cells = $row->getElementsByTagName( 'Cell' );
foreach( $cells as $cell )
{
$ind = $cell->getAttribute( 'Index' );
if ( $ind != null ) $index = $ind;

if ( $index == 1 )$teamname = $cell->nodeValue;
if ( $index == 2 ) $points = $cell->nodeValue;


$index += 1;
}
add_person($teamname,$points);
}
$first_row = false;
}
}
?>



<?
$type=$_REQUEST['type'];

if($type==1)
{?>
<tr><td><table>
<tr>
<th>Team Name</th>
<th>Points</th>

<?
$con=mysql_connect("host","root","pass");
mysql_select_db("dbname");
$sql1=mysql_query("select * from teamodi");
while($result=mysql_fetch_array($sql1))
{
?>

<tr>
<td><?php echo $result['teamname']; ?></td>
<td><?php echo $result['points']; ?></td>

</tr>
<?php }header("location:home.php"); ?>
</table></td></tr>
<? }

else
{
header("location:home.php");
}
ob_end_flush();
?>


The code is working correctly in the local server,
But it is not working in the remote server.
It is giving error that undefined function load.

Please help me to correct this error.How to debug this error..

Fumigator
06-28-2007, 08:19 AM
http://us2.php.net/manual/en/function.dom-domdocument-load.php



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum