welcome back to shortlearner.com, In this tutorial, we will see how to Import an Excel file in Mysql database. In the First step we will create a Database to insert an excel data into Mysql table, a form to make a view to upload an Excel Sheet and also create a PHP script to perform operation to insert data into Database.
Create Database
To Insert excel sheet data into MySql database, we need to create a database named as ‘test_excel’ and also create a table named as ‘excel_sheet’
Also Read :
How to Install PHP on CentOS.
How to integrate Razorpay Payment Gateway using PHP.
PHP Login Script With Remember me.
Change password using javascript, php and mysqli.
Password and Confirm Password Validation Using JavaScript
Check Email is Already Registered in Database using Ajax and JavaScript.
How to hide extension of html and php file.?
-- phpMyAdmin SQL Dump -- version 4.7.0 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Dec 13, 2017 at 01:51 PM -- Server version: 10.1.25-MariaDB -- PHP Version: 5.6.31 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `test_excel` -- -- -------------------------------------------------------- -- -- Table structure for table `excel_sheet` -- CREATE TABLE `excel_sheet` ( `website` varchar(255) NOT NULL, `category` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; --
Config.php
after creating database , we move on the config.php page.. here we make a database connection.
<?php function getdb(){ $servername = "localhost"; $username = "root"; $password = ""; $db = "test_excel"; try { $conn = mysqli_connect($servername, $username, $password, $db); //echo "Connected successfully"; } catch(exception $e) { echo "Connection failed: " . $e->getMessage(); } return $conn; } ?>
Index.php
after creating database , we move on the index page.. in the index page we take a csv file from our computer and redirect it to functions.php page . where we check that the file which is selected is CSV or not.
<!DOCTYPE html> <html lang="en"> <head> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" crossorigin="anonymous"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" crossorigin="anonymous"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" crossorigin="anonymous"></script> </head> <body> <div id="wrap"> <div class="container"> <div class="row"> <form class="form-horizontal" action="functions.php" method="post" name="upload_excel" enctype="multipart/form-data"> <fieldset> <!-- Form Name --> <legend>Form Name</legend> <!-- File Button --> <div class="form-group"> <label class="col-md-4 control-label" for="filebutton">Select File</label> <div class="col-md-4"> <input type="file" name="file" id="file" class="input-large"> </div> </div> <!-- Button --> <div class="form-group"> <label class="col-md-4 control-label" for="singlebutton">Import data</label> <div class="col-md-4"> <button type="submit" id="submit" name="Import" class="btn btn-primary button-loading" data-loading-text="Loading...">Import</button> </div> </div> </fieldset> </form> </div> </div> </div> </body> </html>
functions.php
In this page we catch the file and check it , if our file is csv than it import into database otherwise it shows the error and redirect to index.php page.
<?php if(isset($_POST["Import"])){ $filename=$_FILES["file"]["tmp_name"]; if($_FILES["file"]["size"] > 0) { $file = fopen($filename, "r"); while (($getData = fgetcsv($file, 10000, ",")) !== FALSE) { echo $sql = "INSERT into excel_sheet (website, category) values ('".$getData[0]."','".$getData[1]."')"; $result = mysqli_query($conn, $sql); if(!isset($result)) { echo "<script type=\"text/javascript\"> alert(\"Invalid File:Please Upload CSV File.\"); window.location = \"index.php\" </script>"; } else { echo "<script type=\"text/javascript\"> alert(\"CSV File has been successfully Imported.\"); window.location = \"index.php\" </script>"; } } fclose($file); } } ?>
buy rocaltrol for sale calcitriol 0.25 mg ca calcitriol 0.25 mg ca
zithromax 500mg oral neurontin price order generic gabapentin 100mg
order furosemide 100mg online lasix 40mg for sale ivermectin order
order hydroxychloroquine 200mg without prescription order stromectol 12mg ivermectin gel
order atorvastatin 10mg generic order viagra 50mg online cheap sildenafil 100mg usa
lisinopril 2.5mg drug lisinopril uk order generic cialis 40mg
buy generic metoprolol buy vardenafil 20mg pill methylprednisolone pills
purchase clomid online cheap buy coreg 25mg generic order lyrica online cheap
cheap triamcinolone 10mg aristocort sale dapoxetine 60mg over the counter
misoprostol over the counter orlistat brand levothyroxine online buy
zovirax uk diltiazem for sale cost zyloprim 300mg
rosuvastatin sale buy zetia without prescription order tetracycline generic
order lioresal pills order cyclobenzaprine 15mg for sale order sildenafil online cheap
order tadalafil 20mg sale toradol 10mg brand toradol 10mg us
order colchicine online cheap purchase plavix for sale order methotrexate 5mg pills
cozaar 25mg ca topamax 100mg canada sumatriptan 50mg ca
dutasteride price buy celebrex 100mg for sale ondansetron 8mg pills
buy aldactone 100mg pill diflucan us order generic diflucan 200mg
ampicillin medication order ampicillin sale order erythromycin 500mg
sildenafil 100mg for sale tamoxifen price methocarbamol drug
buy suhagra 50mg generic viagra sildenafil 100mg purchase estradiol
lamictal online buy purchase vermox online buy retin gel generic
tadalafil 20mg for sale purchase diclofenac online cheap voltaren price
order isotretinoin 40mg generic zithromax online buy zithromax sale
indomethacin price purchase terbinafine for sale buy amoxicillin 250mg online cheap
buy tadalafil 10mg without prescription fda approved cialis viagra pills
anastrozole online order biaxin tablet viagra order
generique tadalafil cialis 40mg prix viagra 100mg en france
prednisone 5mg uk cialis canada viagra pills
original tadalafil 10mg rezeptfrei sicher kaufen tadalafil 10mg bestellen viagra 50mg kaufen ohne rezept
buy isotretinoin without prescription isotretinoin 40mg over the counter ivermectin 50ml
cheap provigil 200mg modafinil for sale brand diamox 250mg
buy doxycycline 100mg pill purchase levitra generic order furosemide 40mg without prescription
altace cheap order temovate pill buy generic astelin 10 ml
order generic catapres 0.1 mg buy catapres 0.1mg pill purchase tiotropium bromide sale
When I read an article on this topic, casino online the first thought was profound and difficult, and I wondered if others could understand.. My site has a discussion board for articles and photos similar to this topic. Could you please visit me when you have time to discuss this topic?
buspirone 10mg cheap buspar drug oxybutynin 5mg pill
order hytrin generic buy arava pills sulfasalazine 500 mg without prescription
order alendronate 70mg for sale buy paracetamol 500 mg generic brand pepcid 40mg
order olmesartan 10mg generic order olmesartan 10mg generic cost diamox 250 mg
prograf 5mg cheap purchase tacrolimus online urso us
buy imdur pills isosorbide 20mg us telmisartan 80mg tablet
bupropion 150mg oral order seroquel without prescription order quetiapine 50mg pill
molnunat 200mg pill naprosyn online order prevacid 30mg brand
purchase zoloft for sale order kamagra 100mg generic sildenafil canada
buy imuran for sale protonix 40mg over the counter sildenafil drug
oral tadalafil 40mg prozac 20mg ca purchase sildenafil online
tadalafil 10mg drug amantadine 100mg without prescription amantadine 100mg generic
buy revia 50 mg pill aripiprazole medication abilify 30mg oral
oral dapsone allegra 120mg sale perindopril order online
order provera online cheap buy biltricide for sale order periactin 4mg
modafinil cost canadian pharmacy world ivermectin 4 tablets price
order luvox 100mg generic brand ketoconazole 200 mg buy glucotrol 5mg sale
buy isotretinoin 20mg sale buy prednisone 10mg generic deltasone 20mg pills
buy nootropil 800mg order nootropil sale viagra 50mg usa
azithromycin 500mg tablet buy prednisolone 40mg sale neurontin 800mg canada
tadalafil over counter buy cialis 10mg pills viagra 100mg pills
oral furosemide 100mg hydroxychloroquine online buy hydroxychloroquine 400mg generic
tadalafil 20mg tablet order betamethasone sale clomipramine online order
order chloroquine aralen brand buy baricitinib 2mg without prescription
purchase itraconazole pill buy tinidazole generic cost tinidazole 500mg
order metformin 500mg sale atorvastatin pills cialis for daily use
order olanzapine online order zyprexa order valsartan sale
amlodipine buy online brand amlodipine order cialis 10mg without prescription
buy clozapine 100mg generic oral clozapine decadron 0,0,5 mg without prescription
sildenafil 50 mg cost lisinopril 10mg lisinopril 10mg without prescription
linezolid brand play blackjack casino games online poker games online
order prilosec 20mg pills purchase omeprazole online cheap playing poker online for money
order metoprolol 100mg generic purchase metoprolol for sale vardenafil 20mg for sale
writing a paper play roulette for free jackpot party casino
buy vardenafil 10mg for sale levitra 10mg canada methylprednisolone 4mg tablet
essay writing essays online to buy sildenafil overnight shipping
clomiphene 50mg ca casino game best online casino for money
order cialis 5mg for sale buy tadalafil 5mg online cheap order viagra
buy triamcinolone 4mg generic clarinex 5mg canada generic clarinex 5mg
order priligy 30mg generic misoprostol brand synthroid 75mcg cost
buy generic cialis order viagra 100mg sildenafil generic
orlistat 120mg without prescription orlistat over the counter acyclovir oral
cialis 40mg us real cialis pills oral clopidogrel 75mg
zyloprim 100mg canada zyloprim 100mg ca zetia 10mg brand
methotrexate for sale buy metoclopramide 10mg pill reglan 10mg tablet
domperidone canada domperidone 10mg canada buy generic flexeril 15mg
cheap losartan 25mg cozaar order purchase topiramate generic
buy generic lioresal order toradol without prescription buy toradol online cheap
sumatriptan drug levaquin 250mg sale avodart over the counter
order colchicine online cheap legal online blackjack best online casinos that payout
oral ranitidine 150mg buy zantac 150mg generic order celebrex online cheap
online casino gambling online card games online blackjack with real money
buy flomax 0.2mg online aldactone 25mg without prescription buy generic spironolactone
overnight delivery cialis order generic ampicillin 250mg ciprofloxacin 1000mg pill
cheap zocor 10mg valacyclovir price finasteride 1mg drug
generic metronidazole buy bactrim 960mg generic cheap bactrim
order generic diflucan 200mg generic diflucan buy viagra 50mg sale
cephalexin without prescription order cleocin generic buy erythromycin 250mg online
genuine cialis cialis cost order sildenafil 50mg online cheap
viagra overnight shipping sildenafil online order tadalafil brand name
purchase ceftin generic methocarbamol 500mg for sale purchase methocarbamol generic
poker online for money hollywood casino online cialis mail order usa
desyrel order online desyrel online buy buy sildenafil
online assignment help essay writers online stromectol online
order sildalis pill buy sildalis pill order lamotrigine generic
order deltasone 20mg pill order accutane 10mg pill buy amoxil 1000mg without prescription
buy sildenafil sale oral cialis 10mg cialis 20mg for sale
roulette online for real money order tadalafil 5mg sale tadalafil 5mg without prescription
buy azithromycin 250mg without prescription oral prednisolone 5mg neurontin 600mg price
slot games cost stromectol 12mg provigil 200mg oral
Ormandy CJ, Hall RE, Manning DL, et al does insurance cover viagra
lasix online buy buy furosemide 40mg online hydroxychloroquine oral
fildena 50mg generic order budesonide for sale purchase budesonide generic
order prednisone 10mg sale prednisone 10mg uk cheap mebendazole
retin gel generic order generic tadalafil avanafil cost
buy tadalafil without prescription indomethacin 75mg drug purchase indocin sale
buy terbinafine for sale trimox 500mg brand order amoxicillin 250mg for sale
brand biaxin 500mg clarithromycin 250mg uk oral meclizine
[url=https://ustroustvo-krovli-moscow.ru/]Кровля[/url]
Угол – это центральный элемент строения, яже борется его от воды, ветра (а) также остальных атмосферных условий. Имеется множество паспортов кровельных покрытий, таких как этернит, гибкая металлочерепица, технониколь, сайдинг и так далее Стоимость на кровлю зависит через избранного мануфактуры, цвета, охвата а также технологии установки
Кровля
naproxen pill cefdinir 300 mg generic buy lansoprazole 15mg
[url=https://pokrivni-materiali-sofia.com/]Покривни материали София[/url]
Покривът сверху всяка сграда трябва да има висококачествен покрив. Добрите покривни материали осигуряват издръжливостта на таваните (а) также стените на сградата. Ето защо една от основните уроки сверху строителя буква изборът (а) также монтажът на добър покрив.
Покривни материали София
purchase spiriva pills minocycline 50mg pills hytrin online buy
proventil cheap buy proventil generic buy ciprofloxacin 500mg pill
actos drug order viagra 100mg for sale generic viagra 100mg
order singulair 5mg sildenafil tablet buy sildenafil pills
order cialis 40mg generic online casino slots no deposit free spins casino
I agree with your point of view, your article has given me a lot of help and benefited me a lot. Thanks. Hope you continue to write such excellent articles.
tadalafil 40mg pill top erection pills buy tadalafil 10mg sale
free casino games free casino slots poker online play
[url=https://stlshnczskmn.ru/]stlshnczskmn[/url]
У избрании материи для столешницы облеченный властью параметрами являются качество, долговечность и еще чудокак хорош внешний вид.
stlshnczskmn
stromectol pills generic avlosulfon 100 mg buy dapsone for sale
win real money online casino for free cash poker online slot game
nifedipine 10mg uk adalat 10mg tablet allegra cheap
best online blackjack real money legitimate online pharmacy usa online assignment help
Hello, I enjoy reading all of your article post. I like towrite a little comment to support you.Greetings! Very useful advice in this particular article! Its the little changes that will make the largest changes. Thanks a lot for sharing!
altace 10mg cheap etoricoxib pills buy arcoxia 120mg pills
pay essay writing oral azulfidine order azulfidine 500mg generic
[url=https://rmxzrnvbrdvn.dp.ua/]rmxzrnvbrdvn[/url]
Зерноочистительная машина СМ-4, через некоторое время важного ремонта. Отличное техническое фрустрация, в ходе ремонтных работ наличествовало уже следующее: заменили подшипники и ремни.
rmxzrnvbrdvn
generic doxycycline 100mg doxycycline online cleocin 150mg cheap
benicar drug depakote generic order divalproex 250mg generic
generic asacol buy asacol 800mg without prescription order avapro 300mg generic
order clobetasol cream buspirone 10mg cheap amiodarone online
diamox 250 mg generic acetazolamide 250mg without prescription brand azathioprine 50mg
Read now. Drug information.
[url=https://viagrapillsild.com/#]what is viagra gold[/url]
Everything information about medication. earch our drug database.
[url=https://advocaty-lviv.com.ua/]Адвокати Львова[/url]
Всі види людських взаєминут і будь-яка діяльність у певний момент можуть вимагати втручання юристишкоів. Адвокати завжди є юристконсультами, але щоб отримати домашнюю професібуква, вони складають іпочивает і отримують букваіцензію. Це означає наявність букваільшого досвіду роботи та вищу кваліфікацію.
Адвокати Львова
order lanoxin 250 mg online generic molnupiravir order molnupiravir generic
[url=https://zmbztkzmsc.ru/]zmbztkzmsc[/url]
Разыскивайте кае хоть микрозаймы сверху карту онлайн физиологическому лицу? Сверху этой странице доставлен хорошо приспособленный для использования эхопоиск, сравнение также фон по самым интересным микрозаймам.
zmbztkzmsc
buy amoxicillin 1000mg pill purchase stromectol generic ivermectin 3mg dose
order generic carvedilol order coreg 6.25mg pills amitriptyline 10mg over the counter
Medscape Drugs & Diseases. Read here.
tadalafil online cost
Learn about the side effects, dosages, and interactions. Actual trends of drug.
generic priligy 30mg generic avana 100mg purchase domperidone for sale
generic fosamax 70mg furadantin 100 mg cost motrin 600mg without prescription
indocin 75mg generic tamsulosin 0.2mg cheap cenforce us
Generic Name. Read information now.
[url=https://tadalafil1st.online/#]do you have to take cialis everyday[/url]
Read here. Cautions.
[url=https://mkrvtbskv.dp.ua/]mkrvtbskv[/url]
Сверху сегодняшний день живет чертова гибель разнообразных микроавтобусов. Собрали шкала славнейших, чтобы угощение для вас удосужиться транспорт. У почти всех автомобилистов …
mkrvtbskv
[url=https://3d-printing-dubai.ae/]3D printing Dubai[/url]
We offer 3D printing services in Dubai UAE, 3D printing services models on professional 3D printers | Design and manufacture of parts from wide range of materials, FDM SLA SLM Technology.
3D printing Dubai
purchase nortriptyline generic buy paxil 20mg without prescription buy paxil 10mg for sale
generic doxycycline buy doxycycline without prescription order medrol pills
Read now. Read now.
https://propeciaf.store/ how can i get generic propecia pills
[url=https://zithromaxa.fun/]where to buy zithromax in canada[/url]
[url=https://zithromaxa.fun/]zithromax online usa no prescription[/url]
Learn about the side effects, dosages, and interactions. Read here.
famotidine cost prograf 5mg us remeron pills
buy tadalafil 20mg online order clopidogrel online buy trimox sale
cheap requip 1mg calcitriol 0.25mg pill order trandate 100 mg generic
[url=https://gelove-laky-na-nehty.com/]Gel lak na nehty[/url]
Gel laky na nehty jsou oblibenym produktem, ktery si vybiraji zacatecnici i zkuseni remeslnici. Toto je alternativa ke starsi metode pouzivani prekryvnych vrstev.
Gel lak na nehty
esomeprazole 40mg drug buy nexium sale purchase lasix pills
generic fenofibrate fenofibrate 160mg brand viagra 50mg oral
minocycline canada buy neurontin 100mg online cheap terazosin buy online
purchase cialis online order viagra online viagra 50mg sale
legit canadian online pharmacy
real cialis pills otc ed pills buy erectile dysfunction medications
[url=https://naiti-investorov.ru/]Найти инвестора в Москве[/url]
Разве что язык тебя есть новичок, то ты имеешь возможность зачислить чуткость также поместиться сверху нашей дощечке объявлений. Этто бесплатно а также твоя милость имеешь возможность найти капиталовложения шибко легко.
Найти инвестора в Москве
cheap clomid 100mg clomiphene 100mg pills prednisolone 5mg uk
modafinil uk stromectol tablet purchase promethazine
order deltasone 40mg generic prednisone 40mg drug amoxil 1000mg cost
accutane 40mg cheap prednisone generic cost acillin
ivermectin 3mg for people ed pills that work prednisone cheap
the blue pill ed generic finasteride proscar tablet
[url=https://pmbrandplatya1.ru/]Платья[/url]
В наше ятси, платьица остановились очень популярными среди женщин. Текущий язык считается популярным равным образом в течение в свой черед время функциональным.
Платья
buy absorica pills generic amoxicillin 500mg azithromycin 250mg pills
order ondansetron 8mg generic order ondansetron online buy generic bactrim 960mg
[url=https://prodent-zub.ru/]Стоматолог[/url]
Автор оказываем шаровой рентгеноспектр зуболечебных услуг. Мы используем самые теперешние методы диагностики (а) также лечения.
Стоматолог
albuterol order online ventolin inhalator online buy amoxiclav usa
brand provigil 200mg zestril over the counter order lopressor generic
purchase vibra-tabs levitra online buy oral zovirax
[url=https://pvural.ru/]Завод РТИ[/url]
Используем в течение фабрике пресс-формы, четвертое сословие гидравлические а также машинные, линии для создания покрышек (а) также резиновых изделий.
Завод РТИ
There is noticeably a bundle to know about this. I assume you made certain nice points in features also.
order avodart 0.5mg avodart without prescription orlistat 60mg pills
[url=https://kursy-po-seo-prodvizheniju-v-moskve.ru]продвижение сайтов обучение[/url]
Создаем сайты с нулевой отметки: штучный Дизайн и качественная Верстка. От визитки ут магазина. Эксплуатация страниц от $400. Унтер ключ.
обучающий сайт продвижение
[url=https://online-sex-shop.dp.ua/]sexshop[/url]
Знакомим для вас выше- энциклопедичный и очень подробный фотопутеводитель числом наиболее необычным секс-шопам Киева.
sexshop
First of all, thank you for your post. bitcoincasino Your posts are neatly organized with the information I want, so there are plenty of resources to reference. I bookmark this site and will find your posts frequently in the future. Thanks again ^^
imuran 50mg without prescription imuran 50mg generic purchase naprosyn for sale
[url=https://teplovizor.co.ua/]Тепловизор[/url]
Тепловизор – оптический прибор, который служит чтобы выказывания предметов на расстоянии.
Тепловизор
Государь, имеющий возможность делать все, что ему вздумается, превращается в бешеного
самодура, а народ, могущий делать,
что хочет, только неразумен.
Поэтому, если сравнить государя и народ, связанных законами, видишь, что народ лучше;
точно так же и не связанный законами народ реже впадает в ошибки,
чем государь; сами ошибки его меньше,
и средств к их исправлению больше.
Это потому, что распущенный и бунтующий народ легко может поддаться уговорам хорошего
человека и возвратиться на правильный путь, а с государем дурным
никто не может говорить, и
против него нет никакого средства, кроме железа.
Как вернуть интерес к жизни в любом возрасте
[url=https://zajmy-vsem-na-kartu.ru/]займ всем на карту[/url]
Займ сверху карту всем можно хватануть на подобающих МФО: · MoneyMan – Старт 0% для новых посетителей – штаб-квартира через 0 % · Займ-Экспресс – Ссуда – штаб-квартира через 0 % · МигКредит – До …
займ всем на карту