Welcome To Snipplr
Everyone's Recent PHP Snippets Tagged php
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
# 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
1015
posted 15 years ago by mikegreen
Based on Jdub7's Pure PHP Template function
http://snipplr.com/view/10797/pure-php-template-function/
2
745
posted 15 years ago by thermosilla
Usage:
define('PIRATE',bindec('0001')); // 1
define('NINJA',bindec('0010')); // 2
define('JEDI',bindec('0100')); // 4
define('ADMIN',bindec('1000')); // 8
$rpermit = array(PIRATE,JEDI); // Equivilent Flags '0101'...
0
493
posted 15 years ago by Jdub7
This handy little script will allow you to detect whether or not a user is running FireFox as their browser.
0
738
posted 15 years ago by aristoworks
$quote -- name of function
post_type=page -- remove to query posts
orderby=rand -- random order
showposts=1 -- limit to 1 post
effect -- displays 1 random custom excerpt outside of the loop
1
853
posted 15 years ago by davebowker
Pass in text and the maximum allowable length and this snippet will return as many full sentences from the text as it can within that length. If no sentences, it will just trim to the maximum length allowed.
1
996
posted 15 years ago by DaveChild
Quick little snippet for changing the ordering of a field in a MYSQL database.
1
1022
posted 15 years ago by Zync
First Remove all capital letters, then capitalise the first ones in each word.
1
818
posted 15 years ago by Wardy
1. Edit the html form 'action' to point to your PHP page that handles the upload.
2. Create the php page with the code below
3. Define Paths in PHP lines: 3 , 4 of php file
4. Create matching folder to paths in #3 on server.
5. chmod that folder...
4
992
posted 15 years ago by jadedbat
I thought I would share this simple username password PHP auth script. It leans on HTTP to secure a page.. not bulletproof but quick and painless.
3
898
posted 15 years ago by jadedbat
This will create a list grouped by the sorted field, which is an inner join on a category field.
0
649
posted 15 years ago by fostersolutions