Import Excel file(date) into mysql database in php

Import Excel file(date) into mysql database in php

I try to import excel file which contains data date(yyyy-mm-dd) into mysql database in php. But it not insert the data in mysql.

Code

$fp = fopen("data.csv",'w');
fwrite($fp,ob_get_contents());
fclose($fp);
//echo"----";   
ob_end_clean();
//connect to the database 
$connect = mysql_connect("localhost","root",""); 
mysql_select_db("DBA",$connect); //select the table 
//$file = $_FILES['data.csv']['tmp_name']; 
$handle = fopen('data.csv',"r"); 
//loop through the csv file and insert into database 
GLOBAL $data;
do { 

 if($data[0]!="")
 {
mysql_query("INSERT INTO productsegmentmaster VALUES ( '$data[0]', '$data[1]','$data[2]')"); 

  }
} while ($data = fgetcsv($handle,1000,"*","'")); 
}
fclose($handle);
echo"<script>alert('File $path Imported Successfully')</script>";
unlink('data.csv');
unlink($path);
View Answers

Ads









Related Tutorials/Questions & Answers:
Import Excel file(date) into mysql database in php
Import Excel file(date) into mysql database in php  I try to import excel file which contains data date(yyyy-mm-dd) into mysql database in php...(); //connect to the database $connect = mysql_connect("localhost","root",""); mysql
Import MYSQL file in PHP - PHP
Import MYSQL file in PHP  i wanted to import the mysql file in PHP5 on button click. is it possible to do it? Is there any possibility of data security
Advertisements
how to import excel sheet into mysql database and save it as a table in database
how to import excel sheet into mysql database and save it as a table in database  sir, i want to import an excel sheet into a MySQL database and after importing it i want to store the excel sheet as a table in database
php csv file uploding into mysql database table.
php csv file uploding into mysql database table.  hai friends, i have two excel files with different field names.each files having more than 30 fields. i have one mysql database table with two files fields, when ever i am
php inserting date into mysql
php inserting date into mysql  php inserting date into mysql   Here is a php code that inserts date into mysql database. In the given code, data is a database table. <?php table $query_manual = "INSERT INTO data
how to create a php script to download file from database mysql
how to create a php script to download file from database mysql  how to create a php script to download file from databse mysql
how to create a php script to download file from database mysql
how to create a php script to download file from database mysql  how to create a php script to download file from databse mysql
what is the mysql in the database using php
what is the mysql in the database using php  what is the mysql in the database using php  Please visit the following link: PHP Database
what is the mysql in the database using php
what is the mysql in the database using php  what is the mysql in the database using php  Please visit the following link: PHP Database
write excel file into the oracle database
write excel file into the oracle database  dear sir, i need the jsp code that reads the excel file and stores it into the oracle database table..and also i need the code to connect oracle database? thank u in advance
how to connect to database in php using mysql
how to connect to database in php using mysql  how to connect to database in php using mysql
how to insert excel file into mysql datbase in servlet
how to insert excel file into mysql datbase in servlet  emphashow to insert excel file into mysql datbase inservletized text
How to insert rows from Excel spreadsheet into database by browsing the excel file?
excel file and insert rows into MSSQL database in JSP???   Have a look...How to insert rows from Excel spreadsheet into database by browsing the excel file?  I want to insert rows from excel sheet to database.for this i
PHP Mysql Database Connection
PHP Mysql Database Connection       PHP Mysql Database Connection is used to build a connection... The Tutorial illustrate an example from PHP Mysql Database Connection
php mysql
php mysql  automatically insert a value in the month field at the last date of current month in mysql database
php mysql
php mysql  automatically insert a value in the month field at the last date of current month in mysql database
WANNA IMPORT RAINBOW TABLE IN MYSQL DATABASE
to import rainbow table in mysql database thanks...WANNA IMPORT RAINBOW TABLE IN MYSQL DATABASE  hello, i have... table in one and then i want to import the values of rainbow table in mysql
insert values from excel file into database
the following link: Insert values from excel file to database...insert values from excel file into database   hi i want to insert values from Excel file into database.Whatever field and contents are there in excel
Read data from excel file and update database using jsp
Read data from excel file and update database using jsp  read data from excel file and update database using jsp Hi, I am using a MySQL database... upload excel file and update database using JSP ? Thanks in Advance
How to Import mysql database command line, Import MySQL dumpfile, SQL datafile into my database ?
How to Import mysql database command line, Import MySQL dumpfile, SQL datafile into my database ?  Import mysql database command line, Import MySQL... command at the shell prompt to import sql data file: $ mysql -u username -p -h
in Spring MVC, i would like to download my Mysql database table in pdf,msword,excel formats.
in Spring MVC, i would like to download my Mysql database table in pdf,msword,excel formats.  in Spring MVC, i would like to download my Mysql database table in pdf,msword,excel formats: in View: radio buttons: pdf 2. mswod
PHP code for csv file upload into mysql
PHP code for csv file upload into mysql  I want to upload a file from my pc to mysql server using upload option. while i m selecting the csv file it ll be upload the mysql database. can u send me the coding? i have tried
Export data in excel sheet via Browse and upload button into mysql database
Export data in excel sheet via Browse and upload button into mysql database  how to create a Browse & Upload Buttons and then save the information from it in mysql database's Table Am using struts2,hibernate for making
How to browse excel file and stored the contents into the database using jsp/servlet?
How to browse excel file and stored the contents into the database using jsp/servlet?  Hi.. I want to browse excel file and stored the file data into the My-sql database using jsp/servlet
Excel File data upload into postgresql database in struts 1.x
Excel File data upload into postgresql database in struts 1.x  Dear members please explain how Excel Files data upload into postgresql database in struts 1.x
How to save excel sheet into mysql database using blob or clob
How to save excel sheet into mysql database using blob or clob  Hi All, I am new to java and i need to upload excel sheet to mysql, please suggest me the steps to do this, i am able to connect to the database, from there i don't
how to retrive the particular data from database in php with mysql?
how to retrive the particular data from database in php with mysql?  ... like this.. <?php $con = mysql_connect("localhost","root... in advance  http://www.roseindia.net/tutorial/php/phpdatabase/PHP-MySQL-Login
How to retrive a particular record from database in php with mysql?
How to retrive a particular record from database in php with mysql?  Am using phpMyAdmin Database.In mysql database having 10 records. The field... record based on username and password. I dont know how to retrive in php with mysql
How to Retrieve Data from the database and write into excel file using Java
How to Retrieve Data from the database and write into excel file using Java  Hi, I am trying to develop an small application where i trying to retrieve Data from the database and store the details in excel file. Please can
Mysql Loader Control File
Mysql Loader Control File       Mysql Loader Control File is the mean to import a data... below is used to import the table 'employee1' from Mysql database to a plain
Mysql Loader Control File
Mysql Loader Control File       Mysql Loader Control File is the mean to import a data... is used to import the table 'employee1' from Mysql database to a plain text
Insert data in Excel File from Database using JSP
developed a application to insert data  in excel file from database in JSP. We... the data from database, create an excel file and data insert into newly... and insert the data into excel file. <%@ page import
insert rows from Excel sheet into a database by browsing the file
insert rows from Excel sheet into a database by browsing the file  hello, I am trying to insert rows from Excel sheet into SQL database by browsing Excel file in java(JSP). I can insert rows using ODBC connetion. But using odbc
How to import data from sql server table into an excel file by creating the rows dynamically in the excel according to the dataabase??
How to import data from sql server table into an excel file by creating the rows dynamically in the excel according to the dataabase??  How to import data from sql server table into an excel file by creating the rows dynamically
PHP Date
PHP Date  Hi, How to use PHP Date functions in my PHP program? Thanks   Hi, PHP Date functions is very handy. It is used to progracess, format and create date objects in PHP. There are many ways to use PHP Date
excel to database
excel to database   How to export data from excel sheet to mysql database by using java with request parameter Here q=40 is a request parameter ..request parameter using i export the all data to database   <
Insert current date into MYSQL database
Insert current date into MYSQL database In this tutorial, you will learn how to insert current date into database. In most of the applications, there is a need to insert date or time to database. Mysql provides several datatypes
insert excel sheet into mysql as a table
insert excel sheet into mysql as a table  sir, i want to import an excel sheet into mysql5.0 database as in the table format using tomcat 6.0 by jsp
Retrieve date from MYSQL database
Retrieve date from MYSQL database In this tutorial, you will learn how to retrieve date from database. Storing and Retrieving dates from the database.... The default format of date in MYSQL is YYYY-MM-DD. Example import java.sql.
Excel to database
Excel to database  Hi I want to update SQL database with the values from excel using java code. Can you help me
How to retrieve file name and path of an excel spreadsheet imported into Oracle Database
How to retrieve file name and path of an excel spreadsheet imported into Oracle Database  I imported an excel spreadsheet using sql developer into my Oracle database and I want to know how to retrieve the path of the file
PHP MYSQL Interview Questions
many ways we can store and retrive the date in result set of mysql using PHP... database in mysql. So far i have created only tables in mysql using php code. So...PHP MYSQL Interview Questions  What kind of questions can be asked
Unable to upload a file to mysql database using struts1
Unable to upload a file to mysql database using struts1  Hi, Below...="multipart/form-data"> Select a File :<html:file property="file"/> <...; 2.UploadForm.java import javax.servlet.http.HttpServletRequest; import
PHP MySQL Connect to a Database
PHP MySQL Connect to a Database:       In WAMP software stack, php and mysql are bundled together and we can use... with MySQL server. Following piece of code will help you to check whether your PHP
Mysql Year of Date
Mysql Year of Date       Mysql Year of Date is used to return the current year of the table in database. Understand with Example The Tutorial illustrate an example from 'Mysql Year
upload a file into database and progrm should support excel and text and csv file formats
upload a file into database and progrm should support excel and text and csv file formats  Hai all, I need a program to upload a file into database table... and the program should support .excel ,.txt ,.csv file formats. can
php form post to mysql
php form post to mysql  How to post data into mysql database from the PHP post data form
Mysql Loader Examples
of data  file and then import the data text file into Mysql database. ... the backup created file into table 'Loaded Employee' in Mysql database. mysql>... to create backup file of Table named employee1: The Query is used to import
Mysql Loader Examples
; file and then import the data text file into Mysql database.  Understand... into table 'Loaded Employee' in Mysql database. mysql> LOAD DATA INFILE 'C... Mysql Loader Examples     
how to read data from excel file through browse and insert into oracle database using jsp or oracle???
how to read data from excel file through browse and insert into oracle database..., in these examples MySQL is used as database system if you want to use the Oracle...://www.roseindia.net/answers/viewqa/JSP-Servlet/28123-write-excel-file-into-the-oracle

Ads