I had been wondering the same thing and found this.. hope it's what you were looking for.
<?php
// database connection
function con() {
return mysql_connect(\"localhost\", \"root\");
}
// database selection
function sel() {
return mysql_select_db(\"db_name\");
}
// call it like this
$db = con();
sel();
// Then your query
$query = mysql_query("SELECT * FROM config WHERE config_name='bgcolor'");
while($row = mysql_fetch_assoc($query))
{
print $row[config_value];
}
?>
These 2 functions can save alot of time with queries. You can even call the functions from within an other function.
Thanks to the php kitchen for this!