473,320 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

fetch excel to database in php

1
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;

?>
Mar 29 '14 #1
1 1260
Luuk
1,047 Expert 1GB
Please post your code so that we know where line 33 is.

This website has a nice feature for it!, use the '[CODE/]' tags around your code......
Mar 29 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Garret McGraw | last post by:
Has anybody heard of or know of a python module for reading/parsing/writing microsoft excel databases? Any response would be greatly appreciated. Thanks, GEM
2
by: Jawahar Rajan | last post by:
All, I am trying to export a result set as an excel spread sheet. Most of the time this works as expected, when a user chooses to save as excel the browser pop-up a save as dialog to allow the...
1
by: Selsley | last post by:
I have a very basic Excel spreadsheet with records for staff. I want to print tables in Access but include for each record the Excel spreadsheet column header (e.g. cell A2) How can I print...
3
by: Kuldeep | last post by:
Hi All, Can anyone give me some leads towards uploading the excel file contents into SQL Database Regards Kuldeep
0
by: edsbernardino | last post by:
Hi everyone.. I have an excel spreadsheet as a database. I have a column with different product names on it. Is it possible to query every cell to find the record similar to the capability of Access?...
1
by: tiakang | last post by:
Hi friends, Do you have any guides of how to transfer the excel data into sqlserver 2000 in asp.net and code behind is in vb?
4
by: ashwani2k | last post by:
Hello.. i develope a web projects of horoscope or astrology(http://demo.reallianzbussimart.com/allzodiac.aspx), there is an 12 Zodiaz sign and all the data call on this page through the Database ,...
5
by: tanya2001 | last post by:
ok no prob ok atleast can u tell me how to transfer data from msexcel to sqlserver 2000 using webforms??plzzzz
2
by: Riak | last post by:
Hellow Helpers: I am doing data entry job manually and data is huge. Now I was told to write/get some sort of program/script which can do this job quickly, otherwise I will loose job. I am good...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.