All pastes #365648 Raw Edit

Stuff

public php v1 · immutable
#365648 ·published 2007-02-21 03:12 UTC
rendered paste body
<?php	function getLinkCategories() {	$sql = 'SELECT * FROM			awLinkCats			WHERE LinkCatPublic = 1';	$res = mysql_query($sql);	$i = 0;	while($row = mysql_fetch_assoc($res)) {		$LinkCatData['LinkCatName'][$i]			= $row['LinkCatName'];		$LinkCatData['LinkCatDescription'][$i]	= $row['LinkCatDescription']		$LinkCatData['LinkCatTotalLinks'][$i]	= $row['LinkCatTotalLinks'];		$LinkCatData['LinkCatID'][$i]			= $row['LinkCatID'];		$i++;	}	return $LinkCatData;}function getLinksFromCategory($linkcatid = '') {	$linkcatid = mysql_real_escape_string($linkcatid);	$sql = "SELECT * FROM			awLinks AS AL,			awLinkCats AS ALC			WHERE			ALC.LinkCatPublic = 1			AND			ALC.LinkCatID = {$linkcatid}			AND			AL.LinkCatID = ALC.LinkCatID";	$res = mysql_query($sql);	$i = 0;	while($row = mysql_fetch_assoc($res)) {		$LinkData['LinkCatName'][$i]	= $row['LinkCatName'];		$LinkData['LinkURL'][$i]		= $row['LinkURL'];		$LinkData['LinkName'][$i]		= $row['LinkName'];		$LinkData['LinkID'][$i]			= $row['LinkID'];		$i++;	}	return $LinkData;}// Follow 3 functions are simply placeholders for now.// Need to add errorcatching and logging functions.function incrementLinkCount($linkid) {	mysql_query("UPDATE awLinks SET LinkClickCount = LinkClickCount+1 WHERE LinkID = {$linkid}");}function removeLink($linkid) {	mysql_query("DELETE FROM awLinks WHERE LinkID = {$linkid}");}function removeCategory($linkcatid) {	mysql_query("DELETE FROM awLinkCats WHERE LinkCatID = {$linkcatid}");	mysql_query("DELETE FROM awLinks WHERE LinkCatID = {$linkcatid}");}?>