Welcome To Snipplr


Everyone's Recent Snippets Tagged php



5 1675 posted 18 years ago by jrphelps
Genera links en base a http, www, ftp
2 1858 posted 18 years ago by nicolaspar
MyActiveRecord is a stand alone db abstraction layer to simplify things between php and mysql. you can download the latest version from www.wattz.net
0 1798 posted 18 years ago by wattz
3 1443 posted 18 years ago by JuliaKM
Just a reminder to myself, not really a snippet. When running into memory/speed issues with PHP/MySQL apps, adjust the memory_limit parameter in php.ini.
3 1226 posted 18 years ago by Todd
How to check if a number is odd or even in PHP. Could also use the MOD (%) function, but apparently this method is better performance-wise.
12 3182 posted 18 years ago by andyhartleeds
Drupal snippet: outputs all theming variables of a content type or page. Add to template.php the following function: function _phptemplate_variables($hook, $vars) { return array('vars_data' => $vars); } then add the snippet to the relativ...
5 2546 posted 18 years ago by marcoba
3 1604 posted 18 years ago by lmcdougall
3 1579 posted 18 years ago by lmcdougall
17 10147 posted 18 years ago by lmcdougall
Ej: $ziper = new zipfile(); $filename1 = 'images/imagen1.jpg'; $filename2 = 'images/imagen2.jpg'; $fileZip = 'images/imagen.zip'; $ziper->addFile(file_get_contents($filename1),$filename1); $ziper->addFile(file_get_contents($filename2),$filename...
22 11055 posted 18 years ago by lmcdougall
A quick and simple way to search a MySQL database. Example: mysql_search('items', 'title tags', isset($_GET['q'])?$_GET['q']:'', Array('columns'=>'*', 'method'=>'OR', 'extra_sql'=>'AND active = "true" ORDER BY id DESC'));
5 1691 posted 18 years ago by lmcdougall
This takes about an hour in total to run on my machine, so give yourself enough time. Obviously the configure options will need to be tweaked to match your set up, but this works for me. This assumes you already have MySQL installed.
0 1341 posted 18 years ago by micmath
Shortens a string, and adds a span with a title of the full string. Function is useful for listings where you don't want wraping; or for places where a long string liek a username can break the layout.
1 1702 posted 18 years ago by berkes
2 1364 posted 18 years ago by nicolaspar
0 3637 posted 18 years ago by nicolaspar
Inserts the values of an array into a table. Also supports specifying if a specific field needs to be encoded using PASSWORD() Parameters: Table: Name of table to insert into Data: array of $field->$value of new data Password Field: Which field i...
3 6177 posted 18 years ago by depmed
0 1388 posted 18 years ago by eethann
2 1409 posted 18 years ago by eethann
Add this to httpd.conf/.htaccess
0 1629 posted 18 years ago by hyperwhat
Was fiddling around at work one day thought this might be useful.
9 4803 posted 18 years ago by djdykes
Put classes around your bodyy, to allow different colors for seperate pages and areas on your site. IT will simply add a css-safe version of the first argument in an url. Say the url is /about_us/our_company the class will be body.about-us Require...
2 1573 posted 18 years ago by berkes
The original code was meant to be used with register_globals=on. If you cannot or don't want to turn that on, then I have modified the code to work with register_globals=off.
4 1836 posted 18 years ago by Jaymoon
echo ( browser_detection( 'number' ) .''. browser_detection( 'browser' ) .''. browser_detection( 'os' ) .''. browser_detection( 'os_number' ) ); Outputs (browser version, browser, os, os number): 1.5 moz nt 5.1 if ( ( browser_de...
2 2822 posted 18 years ago by llbbl
1 1700 posted 18 years ago by llbbl
good for parsing a message for urls so you can process them for character length when displayed on screen
3 1525 posted 18 years ago by hdotnet
Don't do it this way. This was written so long ago.
90 12321 posted 18 years ago by llbbl
1 1653 posted 18 years ago by llbbl
This class operates a range of mysql functions base on arrays. Example: Name: Description:
22 11156 posted 18 years ago by emuen