include "config.php"; ?>
System by PA5DX
$direction = $_GET['direction'];
if(!$_GET['direction'])
{
$direction = "desc";
}
if($direction == "desc")
{
$direction = "asc";
}
elseif($direction == "asc")
{
$direction = "desc";
}
$sql = "SELECT *, count('call') as aantal FROM calls ";
if(strlen($_GET['orderby']) > 0)
{
$orderstring = " order by ".mysql_real_escape_string($_GET['orderby'])." ".$direction." ";
}
else
{
$orderstring = " ORDER BY aantal desc, NAME desc";
}
if(strlen($_GET['zoekstring']) > 0)
{
$wherestring = " WHERE `CALL` like '%".mysql_real_escape_string($_GET['zoekstring'])."%' OR NAME LIKE '%".mysql_real_escape_string($_GET['zoekstring'])."%' OR OPERATOR LIKE '%".mysql_real_escape_string($_GET['zoekstring'])."%' OR COUNTRY LIKE '%".mysql_real_escape_string($_GET['zoekstring'])."%'";
}
$sql = $sql." ".$wherestring." group by `CALL` ".$orderstring;
$result = mysql_query($sql) or die (mysql_error());
$c=1;
$aantal = mysql_num_rows($result);
?>