PHP MySQL清除查询

Currently, when the user logs in, the query automatically runs and prints data to the screen. I want the screen to be blank on the initial login, however.

Here is my PHP function that calls the data:

<?php
function displayrecords() {
    $groups = $_POST['mygroup'];
    $type = $_POST['mytype'];
    $service = $_POST['myservice'];
    $sql_json = "SELECT * FROM mytable";

    $where = "";
    if ($groups != "") {
        $where = " `mygroup` = '" . mysql_real_escape_string($groups) . "'";
    }
    if ($type != "") {
        if ($where != "")
            $where .= " AND ";
        $where .= " `mytype` = '" . mysql_real_escape_string($type) . "'";
    }
    if ($service != "") {
        if ($where != "")
            $where .= " AND ";
        $where .= " `myservice` = '" . mysql_real_escape_string($service) . "'";
    }

    if ($where != "")
        $sql_json = $sql_json . " WHERE " . $where . ";";

    $QueryResult = @mysql_query($sql_json) or die(mysql_error());
    echo "<table class='table table-striped table-bordered table-hover'>
";
    echo "<tr><th>ID</th>" . "<th>Group</th><th>Type</th>" .
    "<th>Service</th>" . "<th>Description</th></tr>
";
    while (($Row = mysql_fetch_assoc($QueryResult)) !== FALSE) {
        echo "<tr><td>{$Row[pk_tId]}</td>";
        echo "<td>{$Row[mygroup]}</td>";
        echo "<td>{$Row[mytype]}</td>";
        echo "<td>{$Row[myservice]}</td>";
        echo "<td>{$Row[mydescription]}</td> 
                                                </tr>
";
    };
    echo "</table>
";
    if (mysql_num_rows($QueryResult) == 0) {
        echo "No results";
    }
}

?>

What do I need to add so that this query doesn't execute upon the initial login? In addition, how would I add a reset button?

Thank you in advance.

You could use and check a session variable. i.e.

//In your authentication method
$_SESSION['INITIAL_LOAD'] = true;

//In the code you provided above
    if (!$_SESSION['INITIAL_LOAD']) {
       // run the query stuff
    }

// At the end of the page       
$_SESSION['INITIAL_LOAD'] = false;