when use this code IN SERVER then found fatal error:
Fatal error: Class 'COM' not found in /home/schoolsb/public_html/admin/admin/addexcelstudent .php on line 33
PLEASE HELP ME
<?php
$excel_app = new COM("Excel.appl ication") or Die ("Did not connect");
$Workbook = $excel_app->Workbooks->Open('C:\san1. xls') or Die('Did not open filename');
$Worksheet = $Workbook->Worksheets(1 );
$Worksheet->activate;
$username = "root";
$hostname = "localhost" ;
//connection to the database
$dbhandle = mysql_connect($ hostname, $username) or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
//select a database to work with
$selected = mysql_select_db ("academics",$d bhandle) or die("Could not select examples");
echo "hi";
$i=2;
while($Workshee t->Cells->Item($i,1) != "")
{
$strSQL = "";
$strSQL .= "INSERT INTO tbl";
$strSQL .= "(rollno,crseno ,marks,grade,at t)";
$strSQL .= "VALUES";
$strSQL .= "('".$Works heet->Cells->Item($i,1)."', '".$Workshee t->Cells->Item($i,2)." ' ";
#$strSQL .= ",'".$Works heet->Cells->Item($i,3)."', '".$Workshee t->Cells->Item($i,4)." ' ";
$strSQL .= ",'".$Works heet->Cells->Item($i,3)."', '".$Workshee t->Cells->Item($i,4)." ') ";
mysql_query($st rSQL);
$i++;
}
//*** Close MySQL ***//
@mysql_close($d bhandle);
//*** Close & Quit ***//
$excel_app->Application->Quit();
$excel_app = null;
$Workbook = null;
$Worksheet = null;
?>
Fatal error: Class 'COM' not found in /home/schoolsb/public_html/admin/admin/addexcelstudent .php on line 33
PLEASE HELP ME
<?php
$excel_app = new COM("Excel.appl ication") or Die ("Did not connect");
$Workbook = $excel_app->Workbooks->Open('C:\san1. xls') or Die('Did not open filename');
$Worksheet = $Workbook->Worksheets(1 );
$Worksheet->activate;
$username = "root";
$hostname = "localhost" ;
//connection to the database
$dbhandle = mysql_connect($ hostname, $username) or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
//select a database to work with
$selected = mysql_select_db ("academics",$d bhandle) or die("Could not select examples");
echo "hi";
$i=2;
while($Workshee t->Cells->Item($i,1) != "")
{
$strSQL = "";
$strSQL .= "INSERT INTO tbl";
$strSQL .= "(rollno,crseno ,marks,grade,at t)";
$strSQL .= "VALUES";
$strSQL .= "('".$Works heet->Cells->Item($i,1)."', '".$Workshee t->Cells->Item($i,2)." ' ";
#$strSQL .= ",'".$Works heet->Cells->Item($i,3)."', '".$Workshee t->Cells->Item($i,4)." ' ";
$strSQL .= ",'".$Works heet->Cells->Item($i,3)."', '".$Workshee t->Cells->Item($i,4)." ') ";
mysql_query($st rSQL);
$i++;
}
//*** Close MySQL ***//
@mysql_close($d bhandle);
//*** Close & Quit ***//
$excel_app->Application->Quit();
$excel_app = null;
$Workbook = null;
$Worksheet = null;
?>
Comment