Archive for March, 2021

Assign MySQL Character Set for PHP output

For the old proceedings/programme pages of old events, we were seeing character errors like this:

Thomas L�we

So to fix this I introduced into the configuration.php file the following:

$db=mysql_connect('localhost','username','password') or mysql_die();
mysql_select_db('DBname',$db);
mysql_set_charset('utf8',$db);


PHP.net reference here.

Adding style to hover only when there is href

Today I needed to find a way to style <a> tags that didn’t have href inside them.
You can do that with CSS3 as follows:

a:hover             {background: yellow;}
a:hover:not([href]) {background: none;}

Examples below:

Link One     Link Two     Link Three