473,748 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to insert excel file to mysql?

29 New Member
Can i ask how to insert a file into mysql?

what the different between basename, getElementsByTa gName, DOMdocument and $_FILES?

how to apply it?

thz.
Sep 2 '09 #1
10 4566
Dormilich
8,658 Recognized Expert Moderator Expert
use SQL. there’s a tutorial here. (or look for a tutorial using your favourite search engine)
Sep 2 '09 #2
dreamy
29 New Member
ok, i hv seen the tutorial aldy,

but can i ask a question is 'mysqli'
if i apply mysqli, it will face the problem
Fatal error: Call to undefined function: mysqli_connect( ) in c:\program files\easyphp1-8\www\ll\image\ add_file.php on line 9

if i change mysqli to mysql
the problem will come out such as

Warning: mysql_real_esca pe_string() expects parameter 1 to be string, resource given in c:\program files\easyphp1-8\www\ll\image\ add_file.php on line 12

Warning: mysql_real_esca pe_string() expects parameter 1 to be string, resource given in c:\program files\easyphp1-8\www\ll\image\ add_file.php on line 13

Warning: mysql_real_esca pe_string() expects parameter 1 to be string, resource given in c:\program files\easyphp1-8\www\ll\image\ add_file.php on line 15

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in c:\program files\easyphp1-8\www\ll\image\ add_file.php on line 21
Error! Failed to insert the file
can i ask for the solution? thz
Sep 2 '09 #3
Dormilich
8,658 Recognized Expert Moderator Expert
problem 1: MySQLi is not installed on your system

problem 2: be aware that mysql_* and mysqli_* use a different parameter call (refer to the manual)
Sep 2 '09 #4
dreamy
29 New Member
still cant get it,
can tell more detail, thz.
Sep 2 '09 #5
Markus
6,050 Recognized Expert Expert
The errors are very self-explanatory. You're providing the wrong type of arguments to the functions: mysql_real_esca pe_string() expects a string - you're giving it a resource instead; mysql_query() allows for a resource-link generated by mysql_connect(), however, you're giving it something else.

Read the documentation on these functions.

http://php.net/mysql
Sep 2 '09 #6
Frinavale
9,735 Recognized Expert Moderator Expert
Dreamy,

Please make sure that you have the mysqli extension installed before trying to use it. Once it's installed I'm sure you'll be able to use it properly.

:)

-Frinny
Sep 2 '09 #7
dreamy
29 New Member
ok, can i ask another question about DOMdocument,

if i put like this

Expand|Select|Wrap|Line Numbers
  1. $dom = DOMDocument::load( $_FILES['file']['tmp_name'] );
  2. $rows = $dom->getElementsByTagName( 'Row' );
it come out error
Fatal error: Undefined class name 'domdocument' in c:\

so,
izit i need add...
can tell me? thz
Sep 4 '09 #8
Dormilich
8,658 Recognized Expert Moderator Expert
load() is not a static method, you have to create the DOMDocument object first.
Expand|Select|Wrap|Line Numbers
  1. $do = new DOMDocument;
  2. $do->load(…);
Sep 4 '09 #9
Markus
6,050 Recognized Expert Expert
What PHP version are you using? On top of Dorm's answer, it sounds like you're using PHP 4, which doesn't have DOMDocument. Check out DOM XML for PHP4 (which is terrible, btw), and consider upgrading to PHP5. Developing for PHP4 should've stopped along time ago.

Mark.
Sep 4 '09 #10

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

Similar topics

15
7393
by: Jack | last post by:
I have a text file of data in a file (add2db.txt) where the entries are already entered on separate lines in the following form: INSERT INTO `reviews` VALUES("", "Tony's", "Lunch", "Great atmosphere. Good food.", " (Harry Houdini - 03/01/2004)"); INSERT INTO `reviews` VALUES("", "Le Chow Place", "Lunch", "yada yada", " (Herbert Hoover - 03/03/2004)"); INSERT INTO `reviews` VALUES("", "Golden Dragon", "Lunch", "Exquisite.
0
1555
by: news | last post by:
I have no idea if this is a Linux issue or PHP. Looking for clues here. I have a PHP script which I use to upload a CSV spreadsheet into a mySQL database. (The script follows here in a sec.) I was using WindowsXP and MS Excel to take these sheets, edit it if needed, and save it in text based CSV. Then use the PHP script to upload it and insert into the DB. Now I've eschewed Windows and am using Fedora Core 3. I've tried doing the same...
4
10715
by: Rob | last post by:
Hey, I'm pretty new to MySQL and have a question. I've built a database locally and have inputed some information. I need to go back and update some records, specifically by taking long pieces of text and putting them into text fields. Cutting and pasting in the command prompt for windows isn't such a good idea. Is there a way to update an existing record by importing a text file into a text field?
8
31083
by: Johnny | last post by:
I was looking for information on how to import an excel file or other text file into a MySql database. I have done this with both access and SQL Server and am looking for a way to do this in MySql. I have several hundred items i want to import into a parts database that is currently in an excel file but can be saved as comma separated or other format. Any help would be greatly appreciated. Thanks in advance. Zach
3
2015
by: bawar | last post by:
Hey, I can say I belong to the newbies in this subject. I own my own website with mySQL-databases, but now I have to show one table of those mySQL-databases in an excel worksheet. It is the intention that the user opens the excel-file trough the browser, so I hope there does not have to be installed anything on the clients machine... (I looked at that MyODBC but I don't understand it 100 % yet, I'm newbie hey). It would be very nice if...
11
11279
by: Hi5 | last post by:
Hi, I am new to access I usedto work in Oracle and Mysql. I am after a way that enables me to populate a database I designed in access with lots of data which can be sorted in excel sheets, The source of all data is a very large size (100*2000) excel spread sheet In which some data types are absulotely Irelevant to access data types in my DB there fore I changed It to a number of excel sheets
1
6501
by: Jaime Leivers | last post by:
Here's a median function in access that you can call in any query. You could change this to any excel function you wanted. Most people can find the windows help file that says how to call an excel function but don't know how to pass an array of the recordset they made into that function. This uses GetRows that nicely creates an array that can be passed into excel. I have this data table for testing. The table name is TestData ...
2
7047
josie23
by: josie23 | last post by:
Egad, I'm not a coder/programmer by nature or occupation but understand things like html and css and a small amount of perl. So, basically, I'm a perl/mysql imbecile. But, I've been trying to find syntax to insert values into a mysql database table. I'm able to use the below syntax to insert hard-coded values like 'josie' and 'smith' but can't find working syntax to insert $scalar data from another file (which is really what perl-mysql is...
5
6167
by: Sport Girl | last post by:
Hi everybody. I am new in PERL language and working in it since little hours, actually i am still a trainee and i need help please. In fact, i need a script in PERL that enables me to retrieve data from a table from the database in MySQL and write its contents in an excel sheet file as an excel repot. I have done a script but it is still in draft cause it's not working. Can somebody help me please.
5
5085
by: Sport Girl | last post by:
Hi again my great online assistants, just would like to say that i'm testing the script under unix , and after researches on the internet, i have realised that to resolve 500 Internal Server Error, we should put the script in cgi-bin directory, use of ASCII transfer mode, chmod 755 scriptname.cgi, and then login to unix and type ./scriptname.cgi. I have connected to the database using mysql -u***** -p***** bugs and i could have access to the...
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8831
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9552
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9326
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8245
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4877
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.