This topic is locked

using DAL y Add() To add multiple records

1/24/2017 11:24:04 PM
PHPRunner General questions
F
francoantonacci author

Regards, I have a problem, I need to add several records in a cycle and I'm using DAL whit the function Add(), but only add one and not the amount I require, then I put the scrip:
global $dal;

$tblEvents = $dal->Table("transacciones");

$n = 2;

while ($n <= $ciclos){

$contcontrol=$ncontrol+1;

$tblEvents->Value["control"]=$contcontrol;

$tblEvents->Value["id_usuario"]=$nidusuario;

$tblEvents->Value["fecha_hora"]=$nfechahora;

$tblEvents->Value["tipo_taza"]=$ntipotaza;

$tblEvents->Value["costo"]=$nmonto;

$tblEvents->Add();

$n++;

}

Sergey Kornilov admin 1/29/2017

It should work. It is not clear what is the value of $ciclos variable. Probably you need to make sure it is defined somewhere in your code.