insert date sequence into the bank

Asked

Viewed 55 times

0

When you enter the date in for it sums + 1 day and inserts again.

any idea ?

$valores = range(1,5);
$date = '2016-02-06';                            

            for ( $i = 0, $total = count($valores); $i < $total;  $i++){


            $sql = 'INSERT INTO `lancamentos`(equip,plan,real,data) values(?,?,?,?)';
            $q = $pdo->prepare($sql);

            $q->execute(array($e1,$p1,$r1,$data));            

           $data = date('Y-m-d', strtotime("+1 day" strtotime($data)));



                }
  • I did not understand your question... Give more details than you wish to do.

  • 1

    Explain your question better! If what I understand is correct you want each loop of the for it to add another day on its date, correct? If so, pass the $i variable instead of ("+1 days"). Thus ending strtotime($i . " days", strtotime($data));

  • that’s right, I’ll test it here, thank you.

  • was skipping a few days did not get sequential, but I added a variable to do, thanks to your example, thanks for the help, helped a lot here, thanks!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.