How to Upload Excel File to Single MySQL Table? [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I've seen lots of examples of bulk uploading CSV files to MySQL. However, I have the need to utilize an Excel file, and don't want to trouble the user with saving as CSV. Can anyone provide links to PHP routines they use that will read large Excel files, match the column names to database table columns and upload large (>5k records) efficiently?
Thanks much!

You'd need to use something like PHPExcel to read/parse the Excel files. As for mapping columns to tables, that depends entirely on if the user actually bothers to put column headers into the spreadsheet. If they don't, then you'll just have to guess and it'll undoubtedly NOT work out nicely.
Allowing arbitarirly formatted spreadsheets anywhere near a database makes me cry...

Related

Generate random file in Laravel [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I would like to test a code that I made with randomly generated files with certain extensions(so that I can check validation always works), I've searched for this, but could only find something about faker, it generates random data, but I am looking to generate files in Laravel.
You can do this very thing using PHP alone.
Make an array of names of files manually or see this to generate a random string.
Then define an array of extensions that you want to test against.
And then very easily you can merge the two above to have random files with certain extensions.
If you still have any doubts please let me know and I'll update my answer accordingly.

WooCommerce : Delete products with a list of ids from a CSV file [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 4 years ago.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I have a WooCommerce site on which I have to delete ~12000 products (and all their relations) with a list of ids from a CSV file.
Do you know a good method to do this?
I have thought to use a SQL query or a plugin... but I haven't found nothing interesting expect this old plugin that don't seems to work well : https://wordpress.org/plugins/wc-bulk-product-delete
Thank's in advance!
I dont know from the woo-commerce point of view,whether there is any internal or external tool to delete the records and its related tables.
But purely from a database point of view-
I am assuming database is mysql.
1)First thing you need to do is find the table in database for which you want to delete the records.
2)Find the relations with other tables,if not then define proper relations using keys.
3)Then export the csv into database.Here is one of many links-
How to import CSV file to MySQL table
Before that you should check whether the csv columns match columns of db.Else you just populate into a master kind of table and then by using it you can delete it from main tables
If relationships are properly defined then it will not be difficult to delete from other tables
Hope this helps you

MySQL : Monitor Queries [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I am trying to understand a PHP - MySQL project. The Project is quite complex so exploring it line by line is quite impossible.
What I want to do is, compare the instances of a MySQL database.
Say,
1) MySQL is up and running. This is instance number one of the database.
2) A user logs in from PHP front end, and then logs out.
3) This is instance number two of the database.
I need to see what changed between instance one and instance two, in a friendly way.
Any suggestions regarding open source tools or any other techniques?
You could use mysqldump to take a snapshot of the database, do your login/log out and then dump the database again and use a tool like diff or winmerge to compare the changes.
You could also turn on full query logging in mysql - this is just a single line to the config - http://dev.mysql.com/doc/refman/5.1/en/query-log.html

How to export an html table as a PDF or image? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I am working on creating a website which will allow users to update a table using Javascript.
What I am looking for is a way to allow the user to export the table as an image (jpg, png etc.) or a PDF once it has been modified.
If there is a similar thread or topic please let me know, I don't really know where to start here. If you can recommend background reading that would be great too.
This is not something that can really be done client side (without installing software on the clients, of course). You will need to generate this PDF server-side.
How you do that depends on the language and platform you are using.
There are a couple open source PDF librarys you can use;
SharPDF, PDFClown, iTextSharp just to name a few...

PHP-based CSV editor? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Does anyone know of an online CSV editor written in PHP that will allow a user to open, edit, and save a given CSV file?
All I can find are CSV classes and nothing that can handle dynamic files, just predefined lengths etc.
Parse the CSV file into array. Then, use an array of arrays to populate a matrix of text boxes in your web page. When you submit the form, read the data from $_POST and use fputcsv() to save it.
Think about validation, if relevant.
So you want to be able to open a file, edit it using a web based UI and save it?
Why not use Google Docs?
EDIT: Its irritating when people vote you down without leaving a comment as to why... Useless contributions...
fgetcsv would solve your issue. Basically it takes in CSV file and parses it out into an array.
http://www.phpclasses.org/package/2124-PHP-Retrieve-or-change-information-stored-in-CSV-files.html
Point it at a csv, tell it the delimiter, unique field and tell it to edit. Very simple to use. I've had an issue with the delete button but I only just tried it for the first time, I'm sure I can work that out.
Saved me some hours trying to build and test my own.
Edit: Worked out the issue with the unique column (or KeyFieldName as he calls it) don't have spaces in the name of that column (the first row of the csv)

Categories