MySQL - 绑定变量的数量与令牌的数量不匹配

Can't figure out why this code isn't working:

$update_SQL = $db->prepare($SQL_update);
$update_SQL->execute([$SQL_values]);

And these are dumps of the two strings being inserted into those statements:

$SQL_update = UPDATE laptops SET asset_tag = :asset_tag WHERE id = :id
$SQL_values = 'asset_tag' => 5544, 'id' => 23

You missed : in your code:-

$update_SQL = $db->prepare($SQL_update);
$update_SQL->execute([':asset_tag' => 5544, ':id' => 23]);

So actually what you have to do is:-

$SQL_values =[':asset_tag' => 5544, ':id' => 23]; // create array like this
$update_SQL = $db->prepare($SQL_update);
$update_SQL->execute($SQL_values); // pass that array

Or

$SQL_values =['asset_tag' => 5544, 'id' => 23]; // create array like this
$update_SQL = $db->prepare($SQL_update);
$update_SQL->execute($SQL_values); // pass that array

Note:- execute won't accept a string, it must be an array.