//----------DBLINK get_link; returns database link
/*
function get_link() {
$mysql_link = mysql_connect("localhost", "subdomain", "vankern4n");
mysql_select_db("rebelsquadrons", $mysql_link);
return $mysql_link;
}
*/
/*$mysql_link = get_link();*/
// RESULT getResult; returns result for query and sets reference passed &$cnt with # of results
function getResult($query,&$cnt,$ubersort = ""){
global $mysql_link;
if($ubersort != "NULL" && $ubersort != "") {
$query .= " ORDER by " . $ubersort;
}
$result = mysql_query($query, $mysql_link);
if(!$result) die("getResult($query) - RS SQL ERROR: " . mysql_error());
//print("$query
\n");
$cnt = mysql_num_rows($result);
return $result;
}
/*function query($query){
global $mysql_link;
mysql_query($query, $mysql_link);
if(mysql_error() != "") die("query($query) - RS SQL ERROR: " . mysql_error());
}*/
// array getVal; returns array of values for paticular row
function getVals($result){
return mysql_fetch_row($result);
}
function getRow($query){
$result = getResult($query,$cnt);
return mysql_fetch_row($result);
}
function count_rows($query){
getResult($query,$rows);
return $rows;
}
function get_name($pin){
if ($pin == 0) { return "TBA"; }
$val = getRow("select Name from Roster where ID=$pin");
return $val[0];
}
?>
|