Welcome To Snipplr
Everyone's Recent Snippets Tagged mysql
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
Create a new database and its respective user with all privileges
0
701
posted 12 years ago by claudiodev
How to remap a value to another inside a mysql query select.
0
1089
posted 12 years ago by ginoplusio
You could start a transaction before running your queries and then rollback after running them. Note that to do this you'll require InnoDB or XtraDb tables (won't work on MyISAM).
0
1010
posted 12 years ago by satie83
Allows you to connect to different datasources. Very common to use something like this for development,staging and production deployments.
0
803
posted 12 years ago by evinweissenberg
You have a schedule table (period, day, subject, room) with a primary key period,day to avoid duplicate bookings. You wish to display the schedule as periods, subjects and rooms in rows, and days of the week in columns.
0
852
posted 12 years ago by cahyadsn
Given a birthdate in @dob, here are two simple formulae for age in years :
(the second formulae is for age in years to two decimal places, ignoring day of month)
0
639
posted 12 years ago by cahyadsn
Takes your table name and key=>value array of values and returns the text for inserting into a MySQL database. Automatically surrounds strings with single quotes.
1
1092
posted 12 years ago by lemcoe9
Backup/Export MySQL Database using mysqldump and compress/gzip it
------------------------------------------
0
994
posted 12 years ago by MohamedAlaa
Run This Command in your Terminal
----------------------------------------
mysql -u **username** -p -h localhost **DATA-BASE-NAME** < data.sql
0
841
posted 12 years ago by MohamedAlaa
Instead of the standard return of duplicates, this will actually show the rows that are duplicated, making it easier to see the data
0
737
posted 12 years ago by TheNullByte
Credit goes to [shyul](http://forum.mamp.info/memberlist.php?mode=viewprofile&u=61837"shyul") and the original forum post here: [original_post](http://forum.mamp.info/viewtopic.php?t=14115"original_post")
You need to modify the following file " ...\...
0
1291
posted 12 years ago by manolis
Create a new table from the details of another table then insert the table contents
0
723
posted 12 years ago by imbraz
Author: J. van Hemert
Fixes encoding when utf-8-encoded data
is stored in tables with other (e.g.
latin_swedish_ci) encoding.
Will convert all columns in all tables
to utf8_general_ci.
0
1015
posted 12 years ago by sjasliek
xxxx1... are tables from master site
xxxx2... are tables from client site
0
656
posted 12 years ago by A973C
Example: There is a table, 'user', with a column, 'clear', containing values such as:
`clear
--------
\'animal\'
\'pass'\
`
and we would like to retrieve 'animal' and 'pass' ( without the pre & post \' )
0
967
posted 12 years ago by jgomez
Esto suele ocurrer muy amenudo cuando instalamos Ruby on Rails antes que MySQL. Es un error "Library not loaded: libmysqlclient.18.dylib (LoadError)" donde lista los directorios donde busca y no lo encuentra. La solución es guiarle para que lo encue...
0
921
posted 12 years ago by skozz
in order to avoid the .zip madness when creating a new module, you can make it available in the backend by firing a simple SQL in your DB. (mod_media is the name of the folder that holds it)
0
760
posted 12 years ago by iroybot
Select wp_users and wp_posts to retrieve data from both tables in order to display post title, post date, author name with gravatar (gravatar isn't listed in this code)
Note: probably not idea solution, but it's one of many fixes
0
837
posted 12 years ago by ninacess