Welcome To Snipplr


Everyone's Recent PHP Snippets Tagged mysql



Simple way to escape string for LIKE statements, useful for searches.
3 1345 posted 16 years ago by robv
1 1443 posted 16 years ago by apro2000
Export entire database schema to local xml file.
1 1457 posted 16 years ago by jonniespratley
2 1952 posted 16 years ago by iTony
Database backup function that you can call whenever you want — including nightly CRONs.
6 2861 posted 16 years ago by fackz
0 1348 posted 16 years ago by jonniespratley
I am currently still working on this, and will make changes.
1 1601 posted 16 years ago by jonniespratley
I needed to have a cron job that did some MySQL work iterating through a long list of items based on the content of a table in MySQL. I wanted each item in the table to be iterated over roughly once every 5 minutes, but building up the in-memory lis...
0 1276 posted 16 years ago by cori
0 1354 posted 17 years ago by stavelin
# Export MySQL Data as CSV This code takes a `mysql_query()` resource and outputs its rows into CSV spreadsheet format. Edit the `header('Content-Disposition...` declaration to tell the user's browser to either display the data as plain text or do...
6 2115 posted 17 years ago by mikegreen
1 1470 posted 17 years ago by iTony
Simple but useful function for getting a single piece of data from a database and placing it straight into a variable. Example: $variable = one_result("SELECT columnOne FROM table WHERE columnTwo=whatever"); This would insert the value of colu...
1 1172 posted 17 years ago by iridium
Quick little snippet for changing the ordering of a field in a MYSQL database.
1 1637 posted 17 years ago by Zync
This will create a list grouped by the sorted field, which is an inner join on a category field.
0 1156 posted 17 years ago by fostersolutions
2 1368 posted 17 years ago by czapata
0 1304 posted 17 years ago by iTony
Here is a working example on how to sort data in a grid.
1 1472 posted 17 years ago by assaado
1 1254 posted 17 years ago by assaado
make a query and retrieve the first record, if error occurs show it and the query.
0 1066 posted 17 years ago by ginoplusio
retrieve only one value from the query
0 1228 posted 17 years ago by ginoplusio
0 1387 posted 17 years ago by sebus
1 2674 posted 17 years ago by ghwilson4456
Replace all mysql_query() calls in your project to debug_mysql_query() to see all mysql queries in Firebug console.
1 1652 posted 17 years ago by stancell
3 1480 posted 17 years ago by antpaw
Simplified form to extract data through MySQL
0 1114 posted 17 years ago by LondonWeb
1 1111 posted 17 years ago by LondonWeb
14 2878 posted 17 years ago by iTony
3 1793 posted 17 years ago by benphelps
Been wanting to made one of these for a while and finally I got round to it. For some examples please visit the post: http://www.dom111.co.uk/blog/coding/db/8 Any comments suggestions appreciated. CreativeCommons ShareAlike
3 2872 posted 17 years ago by dom111