PHP:变量数与预准备语句中的参数数量不匹配

I'm getting the following error message in my PHP script;

mysqli_stmt_bind_param(): Number of variables doesn't match number of parameters in prepared statement

But here is the relevant code:

$con = mysqli_connect( $db_url, $db_user, $db_pwd, $db );
$sql = "SELECT * FROM problems WHERE mrn=?";

$stmt = mysqli_prepare( $con, $sql );
mysqli_stmt_bind_param( $stmt, 'i', $sent_mrn );

It points me to the last line there. Am I missing something really obvious? There is only one parameter in the SQL query and I'm binding only one variable! (I know some people will suggest I use PDO, but I gotta use mysqli at the moment)

When using procedural functions (as opposed to object-oriented), you must first call mysqli_stmt_init() to get the statement object. Then you call mysqli_prepare with this statement as the first parameter, NOT the connection as you are currently doing. Also you don't need the return value of mysqli_prepare unless you're meticulously checking for error conditions. Its return value is NOT passed to mysqli_stmt_bind_param, but rather the statement returned from mysqli_stmt_init().

$con = mysqli_connect( $db_url, $db_user, $db_pwd, $db );
$sql = "SELECT * FROM problems WHERE mrn=?";
$stmt = mysqli_prepare($con, $sql); 
$stmt -> bind_param('i', $sent_mrn);

Give this a try.