Import/Export mySQL to CSV class:
This class (not really a class but thought the keyword "class" might help people searching for stuff like this) contains a function which can be fed a mySQL query and a filename. The query is run and the results are saved to a CSV file. There is also a function to import the CSV file back into a database.
I've used this in the past for site administrators who need to edit large amounts of table data. As long as you provide good, easy to follow instructions and maybe preface the import function with an error checker of some sort, this is a really handy way to forego the hassle of creating a html based data editor. People generally prefer to edit large amounts of data in Excel anyway so everyone's a winner!
Here's a quick preview of how it works:
This class (not really a class but thought the keyword "class" might help people searching for stuff like this) contains a function which can be fed a mySQL query and a filename. The query is run and the results are saved to a CSV file. There is also a function to import the CSV file back into a database.
I've used this in the past for site administrators who need to edit large amounts of table data. As long as you provide good, easy to follow instructions and maybe preface the import function with an error checker of some sort, this is a really handy way to forego the hassle of creating a html based data editor. People generally prefer to edit large amounts of data in Excel anyway so everyone's a winner!
Here's a quick preview of how it works:
include("scripts/mysql2csv.php"); //include the script
include("scripts/connect.php"); //connect to your database
$col_names_query="SHOW COLUMNS FROM products;";
$values_query="SELECT * FROM products;";
$fieldseparator=','; //excel needs comma rather than semi colon
$download_file=1; //should the file be downloaded from browser(1) or saved to the server(0)?
$filename = $table; //contains name of download file or (depending on $download_file) the path to save csv file without file extension.
exportCSV($values_query, $col_names_query, $col_count=NULL, $fieldseparator=',', $filename, $download_file);
Instructions and demo of how to use functions are enclosed:
35 comments:
Very useful post. I knew how to produce CSV file in Open Office, but getting the data into MySQL was a challenge. Thanks.
Thankx. Very Usefull script. it would be helpful for me all the times..
thanks for post its save my lots of time
Can i use XLX instead of CSV for import and export . Can u please help me in this.
this is the fantastic one post. because of your post i feel like a good that i got something useful knowledge.
Great tutorial, here another one, it may help you too:
http://www.bewebdeveloper.com/tutorial-about-import-csv-to-mysql-and-export-from-mysql-to-csv-in-php
canada goose
coach factory outlet
coach outlet
ray ban sunglasses
fit flops
canada goose jackets
kate spade outlet
cheap oakleys
birkenstock sandals
birkenstocks
20161228caiyan]
\
site administrators
------------------
شركة نقل اثاث بالدمام
nike outlet store
mulberry outlet
ugg boots
north face jackets
nmd adidas
adidas nmd
ralph lauren uk
coach factory outlet
uggs clearance
louis vuitton outlet store
guess
flip flops
ray ban outlet
ugg
polo ralph lauren
polo lacoste
replica watches
polo ralph lauren
sac burberry
hogan
2018.1.15xukaimin
This is awesome
http://mobihackers.com/
This is nice and informative for the web development services, and really love to read it.
Good Artical,Thanx for shared.software development company in pakistan
At Nasim Laser Skin Clinic, we are focused and committed to meet the increasing needs of our respected customers and valuable patients. Pakistan and its aesthetic laser technology have developed immensely in the past few years.
You no longer have to accept your look patiently. If you are not happy with your facial features you have the
power to change them and look younger.
We specialize in hair transplantation, cosmetic surgery, gyne aesthetics, laser treatments Skin specialist in Lahore ,and other advanced aesthetic procedures.
Our team of specialists and staff at Lahore clinic has years of experience with numerous patients and their different needs. With the help of our treatments, we have transformed their lives with invasive and non-invasive procedures to choose from. At Nasim Laser Center, we certainly have something for everyone.
mbbs in ukraine
ehtelam treatment in lahore
dhant ka ilaaj in lahore
ehtelam ka ilaj in lahore
mushtzani ka ilaaj lahore
namardagi ka ellaj treatment
namardi ka ilaj in lahore
surat e anzal in lahore
shock wave therapy in lahore
oligospermia in lahore
azoospermia in lahore
surate e anzal in lahore
vaginismus treatment in lahore
Technosys Computers is a Canada based company with over nine years of experience in sales and repairing services of computers, laptops, mobile, and their accessories maintaining a good reputation over these years with our highly professional Computer Repair services in Brampton, Cell Phone repair services in Brampton
We are dedicated to pooling our knowledge, experience, tools, and collaborations to provide companies and consumers with a full one-stop solution with all their IT requirements, delivering value that meets their standards and providing them with a sustainable competitive edge
A Pakistan based web development company. Our passion to create Innovative Web Design, Web development, Branding & Digital Marketing services.
Thanks For Sharing This Valuable Information IT Consulting
If you are looking for more information about flat rate locksmith Las Vegas check that right away.
digital marketing agency in lahore
This particular papers fabulous, and My spouse and i enjoy each of the perform that you have placed into this. I’m sure that you will be making a really useful place. I has been additionally pleased. Good perform!
web hosting in lahore
The post is written in very a good manner and it contains many useful information for me. Its full of information I am looking for and I love to post a comment. I am developer in BMSAS Technology. BMSAS Technology is the Software Development Company
This post is really informative and helpful for qweb design and development services. Thanks for sharing.
Ali quick is an extension for aliexpress to Find seller's ratings, similar products, price tracking, save images video. It is Best AliExpress product research tools to find aliexpress extension,
for DropShipping
Thanks For Sharing This Valuable Informationcustom wordpress development company
Thanks For Sharing This Valuable Informationcustom wordpress development company
This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free.
SEO Services in Lahore
Digital Marketing Agency Lahore
You have performed a great job on this article.It’s very precise and highly qualitative. You have even managed to make it readable and easy to read. You have some real writing talent. Thank you so much.
Web Designing in Lahore
Now you can buy almost any plant online across cheer tree Pakistan in major cities including Lahore, Islamabad, Rawalpindi, Karachi and many more. Delivery Service Areas.
this is the fantastic one post. because of your post i feel like a good that i got something useful knowledge.
Logo Designer in Karachi
I really appreciate this wonderful post that you have provided for us.
Regards,
Email Marketing in Karachi
This ia such an amazing and informative post. I really appretiate you have shared all the important details about the topic. Beacon Builder in Pakistan
Great to see such a post on the web, thanks for sharing such with us.
I’d want the power to talk to animals. Imagine what your pets would say!
This is a super handy utility for managing MySQL data efficiently! The ability to export and import CSV files streamlines the workflow, especially for admins who prefer working in Excel. Adding error-checking mechanisms is a smart tip to ensure smooth operations. If you're looking for more tech insights and solutions, feel free to check out website:ChampionTrophy2025.com!
Post a Comment