Press "Enter" to skip to content

Posts published in February 2012

Warning: Invalid argument supplied for foreach()

A common error which occurs with foreach loops is the standard “Invalid argument supplied for foreach()” whch gets thrown up as a warning. This can easily be overcome by wrapping the foreach loop in a conditional if statement which checks to see if the argument supplied to the loop is…

Unable to connect to any of the specified MySQL hosts.

If you get the following error while trying to connect to a MySQL database using a third party client such as TOAD or SQL Workbench, then you need to edit your mysql server’s my.cnf file. Error Message: Unable to connect to any of the specified MySQL hosts. So open the…

PHP nl2br on one line

I usually store data from a textarea directly to the database as is, then once I retrieve it back into HTML I use that lovely PHP function nl2br() to convert it to HTML tags. This works well for most cases until you are passing this data back into javascript where…

fb:login-button not showing on IE8

Make sure you have the following code at the start of your HTML header document [code lang=”html”] [/code]

LEN in MySQL

In MySQL 5.1 LEN is called LENGTH, you use it exactly the same and pass in the link, so: LENGTH(link).