D. srv / srvAmigoConsulta.php

1<?php
2
3require_once __DIR__ . "/../lib/php/ejecutaServicio.php";
4require_once __DIR__ . "/bd/amigoConsulta.php";
5
6ejecutaServicio(function () {
7 $lista = amigoConsulta();
8 $render = "";
9 foreach ($lista as $modelo) {
10 $amiId = htmlentities($modelo->amiId);
11 $amiNombre = htmlentities($modelo->amiNombre);
12 $pasNombre = $modelo->pasNombre === null
13 ? "<em>-- Sin pasatiempo --</em>"
14 : htmlentities($modelo->pasNombre);
15 $render .=
16 "<dt><a href='modifica.html?id=$amiId'>$amiNombre</a></dt>
17 <dd><a href='modifica.html?id=$amiId'>$pasNombre</a></dd>";
18 }
19 return ["lista" => ["innerHTML" => $render]];
20});
21
skip_previous skip_next