473,406 Members | 2,208 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,406 software developers and data experts.

how to upload an excell data into mysql with php

1
there is my script'anyway i am new to php and any help is apprecited thanks.

<?php
// Connect to database
mysql_connect("localhost", "root", "") or die(mysql_error());

mysql_select_db("Massive") or die(mysql_error());

$fp = fopen("emp.txt", "r") // Open the file for reading
while ($line = fgets($fp)) { // Loop through each line
list ($id, $first, $middle, $last) = split("\t", $line, 4); // Split the line by the tab delimiter and store it in our list

$sql = "insert into employees (id, firstname, middlename, lastname) values ('$id', '$first', '$middle', '$last')"; // Generate our sql string

mysql_query($sql) or die ( mysql_error() ); // Execute the sql

}
?>
Oct 19 '11 #1
1 1334
johny10151981
1,059 1GB
You can use PHPExcel to extract data or may be you also can do this.

First export the excel file to csv and then make program to read it in php
Oct 19 '11 #2

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

Similar topics

2
by: Brett B | last post by:
I just installed mysql on linux. If I open a terminal, su to root, then type "mysql", I am able to connect to the server and run my queries. If I exit out of su so that I am my own id (baisley)...
4
by: Piotr | last post by:
Hi I have many files in Excel and I need to transfer them into MySQL, is tehere any free and easy solution ?
0
by: Pk | last post by:
Hi, I want to download and upload the data from acess database into excel file or from excel to database. So how can i use "Excel.Application" to do this type of job. So please help me soon. ...
3
by: Sophisticado | last post by:
Greetings I have a script in which I am collecting sensitive information via a form (METHOD=POST) and encrypting the posted variable (format = BLOB) using mcrypt, then saving it in a MySql...
25
by: Wim Cossement | last post by:
Hello, I was wondering if there are a few good pages and/or examples on how to process form data correctly for putting it in a MySQL DB. Since I'm not used to using PHP a lot, I already found...
6
by: =?Utf-8?B?QWRyaWFuIEpvbmVz?= | last post by:
Hi, I need to regularly check an FTP folder for the presence of a file, and if found, run a routine. Given that this is all on our ISP's servers, what is the best way to automate such a...
1
by: srinu311 | last post by:
How Can We Read Excell Data From Vb.net
1
by: kanmbk | last post by:
Hi, I supposed to upload the data of an excel file in to database. I dont know how to do this. Please help me. Bharathi..
3
by: mishrarajesh44 | last post by:
hiiii, i am making addressbook, which will include name,mobile,address, photo, and want to save in mysql databqse all data and only the name of image file. i want that by clicking the submit...
2
by: =?Utf-8?B?SHVzYW0=?= | last post by:
hi everybody: I have the follwing code that I used it to upload data to my web site: the code: Sub SaveFile(ByVal file As HttpPostedFile) Dim savePath As String =...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
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...

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.