Returns all records from last query and returns contents as array
or FALSE on error
public RecordsArray ( integer $resultType = MYSQLI_BOTH ) : Records | ||
$resultType | integer | (Optional) The type of array Values can be: MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH |
리턴 | Records | in array form |
/** * @return array|bool */ public function membership_roles() { $p = $this->kga['server_prefix']; $query = "SELECT a.*, COUNT(DISTINCT b.userID) as count_users FROM `{$p}membershipRoles` a LEFT JOIN `{$p}groups_users` b USING(membershipRoleID) GROUP BY a.membershipRoleID"; $result = $this->conn->Query($query); if ($result == false) { $this->logLastError('membership_roles'); return false; } $rows = $this->conn->RecordsArray(MYSQLI_ASSOC); return $rows; }
header('Access-Control-Allow-Credentials: true'); header('Access-Control-Max-Age: 86400'); header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: POST, GET, OPTIONS'); header('Content-type: text/html; charset=utf-8'); } if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') { if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])) { header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS"); } if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) { header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}"); } } include "mysql.class.php"; $database = new MySQL(); global $database; if ($database->Query("SELECT mensaje, url FROM kiiconnect_compartir ")) { $mensajes = $database->RecordsArray(); $tags = array(); if ($mensajes != false) { foreach ($mensajes as $mensaje) { $tags['url'] = $mensaje['url']; $tags['mensaje'] = $mensaje['mensaje']; } } //echo $database->GetJSON(); echo json_encode($tags); } else { echo "<p>Query Failed</p>"; }
while ($row = $db->Row()) { echo $row->Color . " - " . $row->Age . "<br />\n"; } // --- Loop through the records another way ------------------------- $db->MoveFirst(); while (!$db->EndOfSeek()) { $row = $db->Row(); echo $row->Color . " - " . $row->Age . "<br />\n"; } // --- Loop through the records with an index ----------------------- for ($index = 0; $index < $db->RowCount(); $index++) { $row = $db->Row($index); echo "Row " . $index . ":" . $row->Color . " - " . $row->Age . "<br />\n"; } // --- We can even grab array data from the last result set --------- $myArray = $db->RecordsArray(); // --- List all of the tables in the database ----------------------- $tables = $db->GetTables(); foreach ($tables as $table) { echo $table . "<br />\n"; } // --- Show the columns (field names) in a table -------------------- $columns = $db->GetColumnNames("test"); foreach ($columns as $column) { echo $column . "<br />\n"; } // --- Find a column (field) type and length ------------------------ echo "Type: " . $db->GetColumnDataType("Color", "Test") . "<br />\n"; echo "Length: " . $db->GetColumnLength("Color", "Test") . "<br />\n"; // --- Get a column's ordinal position (the column number) ---------- echo $db->GetColumnID("Age", "Test") . "<br />\n";
<?php include "mysql.class.php"; $databaseXmltv = new MySQL(); if ($databaseXmltv->Query("SELECT xmltv_canal.id,\n xmltv_canal.nombre as title\n FROM xmltv_canal WHERE activo = 1 ORDER BY orden")) { $canales = $databaseXmltv->GetJSON(); $data = $databaseXmltv->RecordsArray(); } else { $canales = "''"; } ////////////////////////// ?> { "calendars": <?php echo $canales; ?> }
$parametros[0] != "0" ? $richpage = $parametros[0] : ($richpage = ""); $parametros[1] != "0" ? $tag = $parametros[1] : ($tag = ""); $parametros[2] != "0" ? $l = $parametros[2] : ($l = ""); } else { $richpage = ""; $tag = ""; } } else { $header = ""; $richpage = ""; $tag = ""; } // validar que el mismo registro no exista //1 recuperamos el ultimo registro if ($database->Query("SELECT MAX(creado) as creado FROM kiiconnect_mensajes;")) { $data = $database->RecordsArray(); $fechaCreado = $data[0]['creado']; //2 comparamos si existio otro registro similar en el tiempo $sql = "SELECT NOW() as fecha"; if ($database->Query($sql)) { // if ($database->Query("select * from kiiconnect_mensajes where creado > date_sub('2015-09-23 11:16:30', interval 1 minute) ;")) { $data = $database->RecordsArray(); $fechaServidor = $data[0]['fecha']; $datetime1 = new DateTime($fechaCreado); $datetime2 = new DateTime($fechaServidor); $diferencia = $datetime1->diff($datetime2); if ($diferencia->y == 0 && $diferencia->m == 0 && $diferencia->d == 0 && $diferencia->h == 0 && $diferencia->i == 0 && $diferencia->s == 0) { // registro en el mismo minuto se omite } else { // registro se inserta $update["body"] = MySQL::SQLValue($body);
$noticiasOrden = array(); if (count($totalsecciones) != 0) { $total = count($totalsecciones) * 2; } else { $total = 0; } $secciones2 = explode("/", $secciones); $secciones = $secciones2[0]; $seccionesNew = '"' . str_replace(',', '","', $secciones) . '"'; // todo , DAYOFYEAR(kiiconnect_mensajes.creado) para el caso de que se quiera hacer que se repita dependiendo del día $seccion = str_replace('interno', '', $seccionesNew); $resultados = array(); foreach ($totalsecciones as $index1 => $seccion) { $sql = "SELECT kiiconnect_setting.icono,\n kiiconnect_mensajes.id,\n kiiconnect_mensajes.body,\n kiiconnect_mensajes.title,\n kiiconnect_mensajes.header,\n kiiconnect_mensajes.p,\n kiiconnect_mensajes.l,\n kiiconnect_mensajes.tag,\n kiiconnect_mensajes.longuitud,\n kiiconnect_mensajes.latitud,\n kiiconnect_mensajes.richpage,\n kiiconnect_mensajes.activo,\n kiiconnect_mensajes.creado,\n kiiconnect_mensajes.tagsetings,\n kiiconnect_setting.nombre,\n kiiconnect_setting.file\n FROM kiiconnect_mensajes INNER JOIN kiiconnect_setting ON kiiconnect_mensajes.tag = kiiconnect_setting.tag\n WHERE kiiconnect_mensajes.activo = 1 AND kiiconnect_mensajes.tag IN ('{$seccion}') {$fecha}\n\n ORDER BY kiiconnect_mensajes.creado DESC"; if ($databaseKiiconnect->Query($sql)) { if ($databaseKiiconnect->RecordsArray(MYSQL_ASSOC) != 'null') { $data = $databaseKiiconnect->RecordsArray(MYSQL_ASSOC); if ($data) { $resultados = array_merge($resultados, $data); } } else { echo "[]"; } } else { echo "<p>Query Failed</p>"; } } foreach ($resultados as $key => $arr) { $resultados[$key]['body'] = $arr['body']; $pun[$key] = $arr['creado']; if (isset($arr['title'])) {