I'm trying to collect an array of IDs from a MySql DB and update each of them with some values:
global $conn;
$teams = getTeams(); // ID's
$query = "UPDATE t_teams
SET logo = ? WHERE id_team = ?";
foreach($teams as $row) {
$currDir = explode('/', $row["logo"]);
$stmt = $conn->prepare($query);
$stmt->bind_param("si", $currDir[5], $row["id_jogo"]);
$stmt->execute();
}
I'm aware that bind_param
doesn't work like this. There is a bunch of info about this but I can't adapt them to my code.
I think this is something close to what I want: http://php.net/manual/en/mysqli-stmt.bind-param.php#104073
How can I achieve that?