Welcome To Snipplr


Everyone's Recent Snippets Tagged mysql



Create a new database and its respective user with all privileges
0 382 posted 10 years ago by claudiodev
Simple method to insert data to sql
0 360 posted 10 years ago by BergBenji
Update current field data.
0 469 posted 10 years ago by tucq88
How to remap a value to another inside a mysql query select.
0 620 posted 10 years ago by ginoplusio
PDO-format insert array function
0 725 posted 10 years ago by rickygri
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 556 posted 10 years ago by satie83
0 376 posted 10 years ago by inky76
Allows you to connect to different datasources. Very common to use something like this for development,staging and production deployments.
0 464 posted 10 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 424 posted 10 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 384 posted 10 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 522 posted 10 years ago by lemcoe9
Backup/Export MySQL Database using mysqldump and compress/gzip it ------------------------------------------
0 532 posted 10 years ago by MohamedAlaa
Run This Command in your Terminal ---------------------------------------- mysql -u **username** -p -h localhost **DATA-BASE-NAME** < data.sql
0 488 posted 10 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 398 posted 10 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 815 posted 10 years ago by manolis
add created datetime and modified timestamp columns to table
0 370 posted 10 years ago by navblue
Create a new table from the details of another table then insert the table contents
0 393 posted 10 years ago by imbraz
1 558 posted 10 years ago by paul0078
0 490 posted 10 years ago by paul0078
0 515 posted 10 years ago by paul0078
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 543 posted 10 years ago by sjasliek
xxxx1... are tables from master site xxxx2... are tables from client site
0 392 posted 10 years ago by A973C
Update an empty name column in default_comments
0 336 posted 10 years ago by jgomez
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 566 posted 10 years ago by jgomez
Write less and do more mysql in php.
4 673 posted 10 years ago by iceman
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 524 posted 10 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 387 posted 10 years ago by iroybot
0 304 posted 10 years ago by pruntrut
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 456 posted 10 years ago by ninacess