Código PHP:
class X{
private $db;
public function __contruct($db){
$this->db=$db;
}
public function metodo(){
// consultas...
while( $res = $this->link->obtener_fila($result) )
{
$stmt_select->bindParam(1,$res->idmissions);
$result_AM = $stmt_select->execute();
if( !$result_AM )
{
throw new Exception("Error al con al ejecutar la consulta");
}
$count_actions=0;
while( $row = $stmt_select->fetchObject() )
{
$current_tmp = json_decode($row->objectjson);
$current_tmp->amount = $row->amount;
$current_tmp->idaction = $row->idaction;
$types = json_decode($row->type);
$current_tmp->type = $types->type;
$current_tmp->context = $types->context;
$actions[] = array('idaction' => $row->idaction,
'actionIcon' => $row->actionicon,
'description' => $row->description,
'amount' => $current_tmp->amount,
'current' => $current_tmp->current);
$current[] = json_encode($current_tmp);
$count_actions = $count_actions + $row->amount ;
}
$rewardType = explode( '_' , $res->recompense );
$missions[]=array(
'idmission' => $res->idmissions,
'description' => $res->description,
'name' => $res->name,
'reward' => $rewardType[0],
'rewardType' => $rewardType[1],
'actions' => $actions,
'dummy' => $res->dummy,
);
$actions = array();
$stmt->bindParam(1, $this->idufb);
$stmt->bindParam(2, $res->idmissions);
$stmt->bindParam(3, $count_actions);
$stmt->bindParam(4, json_encode($current));
$result_insert = $stmt->execute();
if(!$result_insert)
{
throw new Exception("Error en la insercion");
}
$current = array();
}
}
}
Código PHP:
$X= new x($db);
$X->metodo();
'description' => $res->description,
'name' => $res->name,
no se que esta pasando porque si imprimo el contenido de $res->name antes de guardarlo en el array me muestra el dato pero no queda en el array no se que pasa.
saludos