This is a useful PHP function that takes a query, desired return value, and database link.  It then returns the value.  An example would be to call{codecitation class="brush:php"}echo getOne("select count(*) from people","count(*)",$link);{/codecitation}

This would output the total number of people in the people table.

{codecitation class="brush:php"}

//can be used if you are querying one thing like a count or information for one thing
function getOne($query_passed, $thing, $link)
{
 $oneThing="";
 $query = $query_passed;
 $result = mysql_query ($query, $link);
 if ($result == True) {
  while ($row = mysql_fetch_array($result)) {
   $oneThing=$row["$thing"];
  }
 }
 return $oneThing;
}

{/codecitation}