Exemplo n.º 1
0
function getArrayResp($id_pregunta)
{
    include 'conexion.php';
    $sql = "SELECT id_respuesta FROM preg_resp WHERE id_pregunta = ? ORDER BY id_respuesta DESC";
    mysqli_set_charset($con, "utf8");
    $stmt = $con->prepare($sql);
    $stmt->bind_param("i", $id_pregunta);
    if ($stmt->execute()) {
        $stmt->bind_result($id_resp);
        while ($stmt->fetch()) {
            $respArray[] = getRespuestas($id_resp);
            //Se van agregando las "options" al arreglo.
        }
        $stmt->close();
        mysqli_close($con);
    }
    return $respArray;
}
$stmt = DBExecSql($conn, $sql, $params);
$num = 1;
while ($row = DBGetQuery($stmt)) {
?>
	<tr>
		<th align=left><?php 
echo $row["SE_NOMBRE"];
?>
</th>
<?
	$params = array(":idencuesta" => $_REQUEST["id"]);
	$sql =
		"SELECT pe_id
			 FROM rrhh.rpe_preguntasencuesta
			WHERE pe_fechabaja IS NULL
				AND pe_idencuesta = :idencuesta";
	$stmt2 = DBExecSql($conn, $sql, $params);
	while ($row2 = DBGetQuery($stmt2)) {
?>
		<th align=left><?php 
echo getRespuestas($_REQUEST["id"], $row2["PE_ID"], $row["RP_USUARIO"]);
?>
</th>
<?
	}
?>
	</tr>
<?
}
?>
</table>
$stmt = DBExecSql($conn, $sql, $params);
$num = 1;
while ($row = DBGetQuery($stmt)) {
?>
	<tr>
		<th align=left><?php 
echo htmlspecialchars($row["SE_NOMBRE"]);
?>
</th>
<?
	$sql =
		"SELECT pe_id
			FROM rrhh.rpe_preguntasencuesta
		  WHERE pe_fechabaja IS NULL
			  AND pe_idencuesta = :idencuesta";
	$params = array(":idencuesta" => $_REQUEST["id"]);
	$stmt2 = DBExecSql($conn, $sql, $params);
	while ($row2 = DBGetQuery($stmt2)) {
?>
		<th align=left><?php 
echo htmlspecialchars(getRespuestas($_REQUEST["id"], $row2["PE_ID"], $row["RP_USUARIO"]));
?>
</th>
<?
	}
?>
	</tr>
<?
}
?>
</table>