PHP, Javascript, CSS & mySQL code snippets

This section of our website contains public source code snippets in a variety of languages which are free to use. Snippets include single lines of code to whole functions and classes.

advertisement

Convert string to upper/lower case
in javascript
 

Convert a string to all upper or lowercase in javascript

Select code

 

Get length of array
in javascript
 

Get the amount of items, or length, or an array in javascript

Select code

 

Select random record
in mysql
 

This SQL snippet will select a random record from a mysql database

Select code

 

Create random number
in javascript
 

A snippet to create a random number in javascript

Select code

 

Current URL with PHP
in php
 

A samll function to find the current URL of the page

Select code

 

Breakout of frames
in javascript
 

Little bit of javascript which will automatically break out of frames

Select code

 

Delete all cookies set
in php
 

A 3 line code snippet which will delete all cookies currently set by a website.

Select code

 

Hide and show DIV
in javascript
 

Simple little code which will allow you to toggle the display of a div

Select code

 

IE7 Add to favourites
in javascript
 

A simple add to favourites link for IE7

Select code

 

MySQL connect
in php
 

How to connect to a MySQL database

Select code

 

 
Tips & advice

Need coding help? Tips, tricks or advice? Check out our webmaster forums

advertisement