本文整理汇总了PHP中MySQL::RecordsArray方法的典型用法代码示例。如果您正苦于以下问题:PHP MySQL::RecordsArray方法的具体用法?PHP MySQL::RecordsArray怎么用?PHP MySQL::RecordsArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySQL
的用法示例。
在下文中一共展示了MySQL::RecordsArray方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: membership_roles
/**
* @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;
}
示例2: header
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>";
}
示例3:
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";
示例4: MySQL
<?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;
?>
}
示例5: NOW
$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);
示例6: array
$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'])) {