Skip to content

Instantly share code, notes, and snippets.

@slaskis
Created August 24, 2010 11:39
Show Gist options
  • Save slaskis/547408 to your computer and use it in GitHub Desktop.
Save slaskis/547408 to your computer and use it in GitHub Desktop.
$sql = "SELECT word, COUNT(word) AS count FROM log WHERE true ";
if( isset($_GET["c"]) && $_GET["c"] != "" ) $sql .= " AND county = ". $_GET["c"];
if( isset($_GET["g"]) && $_GET["g"] != "" ) $sql .= " AND gender = '". $_GET["g"] ."'";
if( isset($_GET["b"]) && $_GET["b"] != "" ) $sql .= " AND age BETWEEN ". $_GET["b"] ." AND ". $_GET["t"];
$sql .= " GROUP BY word ORDER BY count DESC LIMIT 10";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment