Das ist Cancel_order-Funktion, die auch in der increase_gameamount()
Funktion aufrufen, ich versuche increament_gameamount()
Funktion aufrufen funktioniert, aber wenn ich versuche, anzurufen Von der While-Schleife ändert sich nichts in der Datenbank.alle meine PHP-Syntax ist wahr, aber Update-Abfrage funktioniert nicht in while-Schleife
//cancel function
function cancel_order($ord) {
global $conn;
$bqty = 0;
$gqty = 0;
$res = array();
echo "entered cancel function " . $ord . "<br>";
$st = "select (B_qty+G_qty) newqt, B_GM_ID from tb_basket b, tb_game g
where b.B_GM_ID = g.G_ID
and B_O_ID='$ord' ";
$sql = $conn->prepare($st);
$sql->execute();
$sql->bind_result($newqt, $gid);
$i = 0;
while($row = $sql->fetch()) {
$res[$i][0] = $newqt;
$res[$i][1] = $gid;
$i++;
}
$j = 0;
$sql->free_result();
$sql->close();
while($j < sizeof($res)) {
echo $gd = $res[$j][0] . "<br>";
echo $qty = $res[$j][1] . "<br>";
increament_gameamount($gd, $qty);
$j++;
}
}
//increament function
function increament_gameamount($gameid, $new_qty) {
global $conn;
echo "entered increament_gameamount function";
echo $gameid;
echo $new_qty;
$varupdateqty = $conn->prepare("update tb_game set G_qty=? where G_ID=?");
$varupdateqty->bind_param("ss", $new_qty, $gameid);
$varupdateqty->execute();
echo "Prepare failed: (" . $conn->errno . ") " . $conn->error;
}
Sie sind nicht eine zweite Variable auf Ihre Anfrage in 'Bindung increament_gameamount' –
können Sie mir die richtige Syntax sagen – John
aber ich Funktion nenne increament_gameamount von einer anderen PHP-Seite, es ohne Fehler funktioniert, bedeutet es, dass das Problem ist nicht in der Funktion, die es mir scheint, bitte sagen Sie mir die richtige Syntax und danke – John