Monday, March 2nd 2020
PHP MySQLDump Browser allows users/system admins to browse through MySQL Database Backups (Dump Files).
Users can view and extract individual table structures and or data from MySQL database dumps.
Use this script to avoid restoring entire backups to recover individual tables.
Database dumps complied by mysqldump and phpMyAdmin are compatible with this tool.
Note: This is an unoffical tool released under the GNU General Public License.
PHP MySQLDump Browser creators have no affiliation with Sun Microsystems.
INSTRUCTIONS:
- Place the script on your webserver or webhost in the same directory as your MySQL backup dumps.
- Run the script.
- Choose which backup file you want to search. The script will search through the
dump file for table structures and data. Depending on the size of the dump, this may take some time.
- Once the script has finished indexing the dump file, you may choose which table you wish to extract or
view. By default the results of your query will display in the iframe at the bottom of the page. However
you may download the results to file by clicking the download link above the iframe.
IMPORTANT: Remove PHP MySQLDump Browser as soon as you are finished.
COPYRIGHT AND DISCLAIMER:
THIS SCRIPT IS PROVIDED AS IS, WITHOUT ANY WARRANTY OR GUARANTEE OF ANY KIND
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General
Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option)
any later version. If you change this script or add any features please tell me.
Download
Categories: Development, Programming, Tools
Tags: development, php, programming
Wednesday, November 13th 2013
After working with different types of data for many years you gain appreciation for a few things. One of the odd things I've gain favor of is the ISO Date Format (YYYYMMDD). This simple concatenation of a four digit year (YYYY), 2 digit month (MM) and 2 digit day (DD) makes it very easy to query and work with. Not to mention this format is internationally recognized and compatible with gregorian and julian calendars. With or without built in programing/scripting language functions I can break this date format down into easy to use parts. Let me show you a few PHP snippets I've used in the past.
Example: Parsing ISO Date Format Using date() and strtotime() Functions
$str_date = 20131231;
$year = date("Y",strtotime($str_date));
$month = date("m"),strtotime($str_date));
$day = date("d"),strtotime($str_date));
echo $year.$month.$day;
Example: Parsing ISO Date Format Using substr() Function
$str_date = 20131231;
$year = substr($str_date,0,4);
$month = substr($str_date,4,2);
$day = substr($str_date,6,2);
echo $year.$month.$day;
Where I think this date format really shines is in SQL queries. Because of the nature of the date format being an integer it makes it easy to find all the dates between a range of dates. For example say if I wanted all records where the date is between January 1st 2013 and October 21st 2013. My query would look something like the example below.
SELECT * FROM records WHERE mydate BETWEEN 20130101 AND 20131021;
What if I needed a quick and dirty way of querying for all records during one month (April 2013) or even a full year (2013). My queries could look something like the examples below.
SELECT * FROM records WHERE mydate LIKE '201304%';
SELECT * FROM records WHERE mydate LIKE '2013%';
One last thing about this date format. How can we convert to it? Well Below are some examples in different languages. I hope this may have inspired you to take a look at this date format. I know it makes my life easier as a developer at times. In a future article I'll talk about the benefits of using Unix timestamps as well.
date("Ymd"),strtotime("yourdatehere"));
date_format(date(NOW(),'%Y%m%d'))
new Date().toISOString().slice(0,10).replace(/-/g,"")
to_date('20170101','yyyymmdd')
CAST(CAST('20170101' AS varchar) AS datetime)
Sources:
w3.org
Categories: Snippets
Tags: development, mysql, php