PHP Mysqli更新网址点击[重复]

$short = $_REQUEST[ "short" ];

    $mysqli = new mysqli( DB_HOST, DB_USERNAME, DB_PASSWORD, DB );

    $clicks = $mysqli->query("SELECT clicks FROM leafy_urls WHERE short = '$short'")->fetch_object()->clicks;

    $clicks++;

    $statement = $mysqli->prepare( "UPDATE leafy_urls SET clicks=? WHERE short=?" );
    $statement->bind_param('is', $clicks, $short );

    $results =  $statement->execute();

    if( $results )
    {
        $long_url = $mysqli->query("SELECT long_url FROM leafy_urls WHERE short = '$short'")->fetch_object()->long_url;
        Header("HTTP/1.1 301 Moved Permanently");
        header("Location: " .$long_url. "");
    }
    else
    {
        //$html = "Error: Cannot find short URL";
        $html = 'Error : ('. $mysqli->errno .') '. $mysqli->error;
    }

    $mysqli->close();

This code works to the point it doesn't throw error but the number in the database does not increase. Stays at 1

</div>

Good that you use prepared statements but you should use it for all your input values, like so:

$statement = $mysqli->prepare("UPDATE leafy_urls SET clicks=clicks+1 WHERE short = ?");
$statement->bind_param( 's', $short );

Also note that you can use purely sql for incrementing a value.