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

Add string to field
in mysql
 

Allows you to add a string to end or start of a field to use when comparing or selecting data. The second argument is added to the end of the first

Select code

 

Counting records
in mysql
 

This query will return the amount of records for the query

Select code

 

Selecting the minimum value
in mysql
 

Selecting the minimum value of the field in the brackets.

Select code

 

Selecting the maximum value
in mysql
 

Selecting the maxmimum value of the column in the brackets.

Select code

 

Select random record
in mysql
 

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

Select code

 

Selecting distinct entries
in mysql
 

This query will show you how to select only distinct (unique) entries from a database.

Select code

 

 
Tips & advice

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

advertisement