473,396 Members | 1,877 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,396 software developers and data experts.

how to insert excel file to mysql?

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

what the different between basename, getElementsByTagName, DOMdocument and $_FILES?

how to apply it?

thz.
Sep 2 '09 #1
10 4536
Dormilich
8,658 Expert Mod 8TB
use SQL. there’s a tutorial here. (or look for a tutorial using your favourite search engine)
Sep 2 '09 #2
dreamy
29
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_escape_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_escape_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_escape_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 Expert Mod 8TB
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
still cant get it,
can tell more detail, thz.
Sep 2 '09 #5
Markus
6,050 Expert 4TB
The errors are very self-explanatory. You're providing the wrong type of arguments to the functions: mysql_real_escape_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 Expert Mod 8TB
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
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 Expert Mod 8TB
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 Expert 4TB
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
dreamy
29
i hv done the upload file with the csv type,
but now,
after upload a csv file,
data hv insert into database
izit can delete a row data from database?
Sep 8 '09 #11

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

Similar topics

15
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...
0
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...
4
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...
8
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...
3
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...
11
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, ...
1
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...
2
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...
5
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...
5
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...

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.