在Mysqli中实现可扩展的搜索查询

I am trying to migrate to Mysqli and I got my Mysql code to search for parameters like this:

$querySt = "SELECT userID FROM myTable";
if (isset($_POST["UserID"])) {
    if (ctype_digit($_POST["UserID"])) {
        addWhereIfNoHave();
        $in_userID = mysql_real_escape_string($_POST["UserID"]);
        $querySt .= " UserID = '$in_userID'";
    }
}

if (isset($_POST["name"])) {
    addWhereIfNoHave();
    $in_name = mysql_real_escape_string($_POST["name"]);    
    $querySt .= " imgName LIKE LOWER('%$in_name%')";
}

if (isset($_POST["ScoreLessThan"])) {
    if (ctype_digit($_POST["ScoreLessThan"])) {
        addWhereIfNoHave();
        $in_ScoreLessThan = mysql_real_escape_string($_POST["ScoreLessThan"]);
        $querySt .= " Score < '$in_ScoreLessThan'";
    }           
}

...
...
there are other if statements here looking for other post data, and 
they keep on adding parameters into mysql query string just like above.
...
...

//this function is called in those if statements above. It either adds "WHERE" or "AND".
function addWhereIfNoHave(){
    global $querySt;
    if (strpos($querySt, 'WHERE') !== false){
        $querySt .= " OR";  
        return true;
    }else{
        $querySt .= " WHERE";
        return false;
    }
}

This function works ok looking for all the parameters input from PHP post. However, I am migrating this to Mysqli, and I have a bit of trouble converting this code to Mysqli version. For example,

$stmt = $conn->prepare("SELECT userID FROM myTable WHERE UserID = ? AND name= ?");
$stmt->bind_param('ss', $userid, $name);

Suppose, I wanna search the table using 2 variables, I bind 2 variables like above, but in the case of my Mysql above, I keep on extending additional parameters into the string before executing the mysql query.

But for Mysqli, how can we do this? Is it possible to bind additional parameters and extending the string for prepare statement like Mysql code above? How should this problem be approach for Mysqli?

My current problem is mainly with the bind_param. I could concatenate the search query further and add all the '?' into the prepare statement, but with different variable types and number variables needed to be specified in bind_param, this is where I am stuck.