How to use bind_param without repeating variables

0

This code here inserts the parcels of a payment, the m1, m2, m3 and etc are variables that add a month to the current date, for example $m1 = date('Y-m-d',strtotime("+1 month"));

$stmt20 = $conexao->prepare("
        INSERT INTO esc_usuarios_pgtoparcelas (parcela_codigo_plano, parcela_mes, parcela_valorBonificacao, parcela_situacao)
        VALUES
        (LAST_INSERT_ID(), ?, ?, ?),
        (LAST_INSERT_ID(), ?, ?, ?),
        (LAST_INSERT_ID(), ?, ?, ?),
        (LAST_INSERT_ID(), ?, ?, ?),
        (LAST_INSERT_ID(), ?, ?, ?),
        (LAST_INSERT_ID(), ?, ?, ?),
        (LAST_INSERT_ID(), ?, ?, ?),
        (LAST_INSERT_ID(), ?, ?, ?),
        (LAST_INSERT_ID(), ?, ?, ?),
        (LAST_INSERT_ID(), ?, ?, ?),
        (LAST_INSERT_ID(), ?, ?, ?),
        (LAST_INSERT_ID(), ?, ?, ?)
    ");
    $stmt20->bind_param('sdssdssdssdssdssdssdssdssdssdssdssds',
        $m1, $zero, $parcela_situacao_prog,
        $m2, $zero, $parcela_situacao_prog,
        $m3, $zero, $parcela_situacao_prog,
        $m4, $zero, $parcela_situacao_prog,
        $m5, $zero, $parcela_situacao_prog,
        $m6, $zero, $parcela_situacao_prog,
        $m7, $zero, $parcela_situacao_prog,
        $m8, $zero, $parcela_situacao_prog,
        $m9, $zero, $parcela_situacao_prog,
        $m10, $zero, $parcela_situacao_prog,
        $m11, $zero, $parcela_situacao_prog,
        $m12, $zero, $parcela_situacao_prog);
    $stmt20->execute();

Everything is working as it should, however, I feel like I'm doing it the wrong way, it seems repetitive and redundant, how can I decrease this code without repeating the same variables, parameter values?     

asked by anonymous 07.12.2018 / 15:52

0 answers