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.application") 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",$dbhandle) or die("Could not select examples");
echo "hi";
$i=2;
while($Worksheet->Cells->Item($i,1) != "")
{
$strSQL = "";
$strSQL .= "INSERT INTO tbl";
$strSQL .= "(rollno,crseno,marks,grade,att)";
$strSQL .= "VALUES";
$strSQL .= "('".$Worksheet->Cells->Item($i,1)."','".$Worksheet->Cells->Item($i,2)."' ";
#$strSQL .= ",'".$Worksheet->Cells->Item($i,3)."','".$Worksheet->Cells->Item($i,4)."' ";
$strSQL .= ",'".$Worksheet->Cells->Item($i,3)."','".$Worksheet->Cells->Item($i,4)."') ";
mysql_query($strSQL);
$i++;
}
//*** Close MySQL ***//
@mysql_close($dbhandle);
//*** Close & Quit ***//
$excel_app->Application->Quit();
$excel_app = null;
$Workbook = null;
$Worksheet = null;
?>