Category: Web Development

jquery load stylesheet into frame

For when I forget next time: <iframe name=”framename” id=”framename” src=”something.html”></iframe>$(‘body’,framename.document) .append(‘<link rel=”stylesheet” href=”http://mysite.com/stylesheet.css” />’); or use this awesome jquery plugin: http://ideamill.synaptrixgroup.com/?p=6 it allows you to easily run code and load css/javascript into iframes

Simple PHP MySQL Database Functions

A simple bit of code to make PHP database connections a little easier to use.<?phpfunction db_connect(){ $db = mysql_connect(DB_HOST,DB_USER,DB_PASS) or die(“Cannot connect”); $dbcnx = mysql_select_db(DB_NAME) or die (“Cannot select db”); return $db;}function query($sql,$db){ $res = mysql_query($sql,$db) or die(“Error in sql $sql: “.mysql_error()); return $res;}function qa($sql,$db){ $res = query($sql,$db); $data = array(); while($row = mysql_fetch_assoc($res)){ if($res[‘id’])$data[$res[‘id’]] […]