“;
	$Repeat = ” “;
	$count = 0;
//	while ($Repeat){
//    $Draw = GetSingleDraw(“”);
// RJL 3/23/13
// should be a function
	// Determine how many rows of history we have
	$sql = “SELECT COUNT(*) R FROM LottoHistory”;
	$rowsCount = @mysql_query($sql);
	// Handle the errors
	if (!$rowsCount) {
	    $message  = ‘Invalid query: ‘ . mysql_error() . “\n”;
	    $message .= ‘Whole query: ‘ . $sql;
	    die($message);
	}
	else
	{
		$rows = mysql_fetch_assoc($rowsCount);
	}
	// Calculate the frequency variable using the Rows Count
	// Because there are 6 entries for each Date, we divide by 5
	// Then take age % of those
	// Then round it to a whole number
	if ($_REQUEST[“age”])
		$a = $_REQUEST[“age”];
	else
		$a = 100; 
	$age = $rows[“R”];
	$age = $age * ($a * .01);
	$age = round($age);
//	echo “
rows =>” . $rows[“R”] . “<=
“;
//	echo “
age =>” . $age . “<=
“;
	if (isset($_REQUEST[“sample”]))
		$sample = $_REQUEST[“sample”];
	else
		$sample = 20;
	// Get the Kicker
	$sql = “SELECT * FROM “;
	$sql = $sql . “(SELECT * FROM “;
	$sql = $sql .  “(SELECT Draw, COUNT(Draw) AS Draws, (YEAR(MIN(Date))  & ‘-‘ & MONTH(MIN(Date)) & ‘-‘ & DAY(MIN(Date))) AS Last_Draw FROM “;
	$sql = $sql .  “(select an.draw, lh.date as Date, an.kicker from AvailableNumbers an  “;
	$sql = $sql .  “left join LottoHistory lh on an.draw = lh.draw and lh.kicker = 1 “;
	$sql = $sql .  “where an.kicker=1) as f “;
	$sql = $sql .  “GROUP BY Draw)  AS d   “;
	$sql = $sql .  “ORDER BY d.Draw, d.Last_Draw DESC  LIMIT ” . $age . “) AS e “;
	$sql = $sql .  “ORDER BY RAND() LIMIT ” . $sample;
//	echo $sql;
	// Save the result for later
	$kicker = @mysql_query($sql);
	// Handle the errors
	if (!$kicker) {
	    $message  = ‘Invalid query: ‘ . mysql_error() . “\n”;
	    $message .= ‘Whole query: ‘ . $sql;
	    die($message);
	}
	else
	{
		$kick = mysql_fetch_assoc($kicker);
	}
	// Get the Draws
	$sql = “SELECT Draw, Draws, Last_Draw “;
	$sql = $sql .  “FROM  (SELECT Draw, Draws, Last_Draw “;
	$sql = $sql .  “FROM  (SELECT Draw, COUNT(Draw) AS Draws, YEAR(MIN(Date)) & ‘-‘ & MONTH(MIN(Date)) & ‘-‘ & DAY(MIN(Date)) AS Last_Draw “;
	$sql = $sql .  “FROM  (SELECT an.Draw, COUNT(lh.Draw) AS Draws, lh.Date, lh.Kicker “;
	$sql = $sql .  “FROM  AvailableNumbers AS an LEFT OUTER JOIN “;
	$sql = $sql .  ”      LottoHistory AS lh ON an.Draw = lh.Draw “;
	$sql = $sql .  “GROUP BY an.Draw, lh.Date, lh.Kicker) AS c “;
	$sql = $sql .  “WHERE (Kicker = 0) OR “;
	$sql = $sql .  “(Kicker IS NULL) “;
	$sql = $sql .  “GROUP BY Draw) AS d “;
	$sql = $sql .  “ORDER BY Draws, Last_Draw DESC LIMIT ” . $age . “) AS e “;
	$sql = $sql .  “ORDER BY RAND()  LIMIT ” . $sample;
//        echo $sql;
	// Save the Result
	$result = @mysql_query($sql);
	// Handle Errors
	if (!$result) {
	    $message  = ‘Invalid query: ‘ . mysql_error() . “\n”;
	    $message .= ‘Whole query: ‘ . $sql;
	    die($message);
	}
        $Pick=””;
	// Process the results
	for ($p=0; $p<5; $p++) {
	    $row = mysql_fetch_assoc($result);
	    $Pick = $Pick . $row['Draw'] . "-";
	}
	
	$Draw = $Pick . $kick['Draw'];
// End should be function
// $Draw = "9-19-34-44-51-24";
// RJL - Commented all this out
//	    $Repeat = IsDuplicatePick($Draw);
//
////            var_dump($Repeat);
//	    $count = $count + 1	;
//            if ($count > 5) {
//                break;
//            }
//	}
//	echo “DRAW=”;
//	var_dump($Draw);
//	echo “
“;
	$B = explode(“-“,$Draw);
//	echo “B=”;
//	var_dump($B);
//	echo “
“;
	$Ball[0] = $B[0];
	$Ball[1] = $B[1];
	$Ball[2] = $B[2];
	$Ball[3] = $B[3];
	$Ball[4] = $B[4];
	sort($Ball, SORT_NUMERIC);
//	echo “Ball=”;
//	var_dump($Ball);
//	echo “
“;
	for ($y=0; $y<5; $y++) {
            echo "
“; “;echo $Ball[$y];
 echo “
 | 
	}
        echo “
“; “;	echo $B[5];echo “
 | 
	echo “