本文整理汇总了PHP中MySQL::RowCount方法的典型用法代码示例。如果您正苦于以下问题:PHP MySQL::RowCount方法的具体用法?PHP MySQL::RowCount怎么用?PHP MySQL::RowCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySQL
的用法示例。
在下文中一共展示了MySQL::RowCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dupeCheck
public function dupeCheck($name)
{
$db = new MySQL(true, 'color64', 'localhost', 'color64', 'nu5Jc4JdtZK4RCHH');
$q = $db->Query("SELECT `id` FROM `users`");
$allrecords = $db->RowCount();
$q = $db->Query("SELECT `id` FROM `users` WHERE `name` LIKE '" . $name . "';");
if ($db->RowCount() > 0) {
$dupes = $db->Row()->id;
} else {
$dupes = 0;
}
return array('total' => $allrecords, 'dupe' => $dupes);
}
示例2: global_role_allows
/**
* Check if a global role gives permission for a specific action.
*
* @param integer $roleID the ID of the global role
* @param string $permission name of the action / permission
* @return bool true if permissions is granted, false otherwise
*/
public function global_role_allows($roleID, $permission)
{
$filter['globalRoleID'] = MySQL::SQLValue($roleID, MySQL::SQLVALUE_NUMBER);
$filter[$permission] = 1;
$columns[] = "globalRoleID";
$table = $this->kga['server_prefix'] . "globalRoles";
$result = $this->conn->SelectRows($table, $filter, $columns);
if ($result === false) {
$this->logLastError('global_role_allows');
return false;
}
$result = $this->conn->RowCount() > 0;
/*
// TODO should we add a setting for debugging permissions?
Kimai_Logger::logfile("Global role $roleID gave " . ($result ? 'true' : 'false') . " for $permission.");
*/
return $result;
}
示例3: get_media_group_part
/** Lấy đường dẫn nhóm media */
function get_media_group_part($id = 0, $i = 1, $deepest = FALSE)
{
$hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
if (!is_numeric($id)) {
$tableName = DB_PREFIX . 'media_groups';
$whereArray = array('folder' => MySQL::SQLValue($id));
$hmdb->SelectRows($tableName, $whereArray);
$row = $hmdb->Row();
$id = $row->id;
}
$bre = array();
$sub_bre = FALSE;
if ($deepest == FALSE) {
$deepest = $id;
}
$tableName = DB_PREFIX . 'media_groups';
$whereArray = array('id' => MySQL::SQLValue($id));
$hmdb->SelectRows($tableName, $whereArray);
$row = $hmdb->Row();
$num_rows = $hmdb->RowCount();
if ($num_rows != 0) {
$this_id = $row->id;
$folder = $row->folder;
$parent = $row->parent;
$bre['level_' . $i] = $folder;
if ($parent != '0') {
$inew = $i + 1;
$sub_bre = get_media_group_part($parent, $inew, $deepest);
}
}
if (is_array($sub_bre)) {
$bre = array_merge($bre, $sub_bre);
}
krsort($bre);
$part = implode("/", $bre);
if ($deepest == $id) {
return $part;
} else {
return $bre;
}
}
示例4: while
}
$nbrlocalreq = $db->RowCount();
while (!$db->EndOfSeek()) {
$row = $db->Row();
$dbd->Query($row->req);
}
$db->Query("update temprequet set stat=1 where stat=0");
// ---------------------------------------------------
// Execute Remote requete on locoal server
// ---------------------------------------------------
global $db;
$fullquery = "SELECT req,id from temprequet where stat=0 ";
if (!$dbd->Query($fullquery)) {
$dbd->Kill($dbd->Error());
}
$nbrremotreq = $dbd->RowCount();
while (!$dbd->EndOfSeek()) {
$row = $dbd->Row();
if (!$db->Query($row->req)) {
$db->Kill($db->Error());
} else {
$dbd->Query("update temprequet set stat=1 where id=" . $row->id);
}
}
// ---------------------------------------------------
// Insert log Last update
// ---------------------------------------------------
$nbrreq = $nbrlocalreq + $nbrremotreq;
$lastmaj = "Insert into maj_sys(nbrreq,user)values({$nbrreq}," . $_SESSION['userid'] . ")";
if (!$db->Query($lastmaj)) {
$db->Kill($lastmaj);
示例5: backupDatabase
function backupDatabase($dbName, $backupStructure = true, $backupData = true, $backupFile = null)
{
$columnName = 'Tables_in_' . $dbName;
$this->done = false;
$this->output .= "-- SQL Dump File \n";
$this->output .= "-- Generation Time: " . date('M j, Y') . " at " . date('h:i:s A') . " \n\n";
$this->output .= "-- \n";
$this->output .= "-- Database: `{$dbName}` \n";
$this->output .= "-- \n\n";
$conn = new MySQL(true, DBNAME, DBHOST, DBUSER, DBPASS, "", true);
$strTables = 'SHOW TABLES';
$conn->Query($strTables);
$cntTables = $conn->RowCount();
if ($cntTables) {
$conn->MoveFirst();
while (!$conn->EndOfSeek()) {
$rsTables = $conn->Row();
if ($backupStructure) {
$this->dumpTableStructure($rsTables->{$columnName});
}
if ($backupData) {
$this->dumpTableData($rsTables->{$columnName});
}
}
} else {
$this->output .= "-- \n";
$this->output .= "-- No tables in {$dbName} \n";
$this->output .= "-- \n";
}
if (!is_null($backupFile)) {
$this->dumpToFile($backupFile);
}
$this->done = true;
}
示例6: user_show_data
/** bảng danh sách thành viên */
function user_show_data($user_group, $perpage)
{
$hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
hook_action('user_show_data');
$request_paged = hm_get('paged', 1);
$paged = $request_paged - 1;
$offset = $paged * $perpage;
$limit = "LIMIT {$perpage} OFFSET {$offset}";
if (!$hmdb->Query("SELECT * FROM " . DB_PREFIX . "users WHERE `user_group` = '{$user_group}' ORDER BY id DESC {$limit}")) {
$hmdb->Kill();
}
if ($hmdb->HasRecords()) {
/* Trả về các user */
while ($row = $hmdb->Row()) {
$array_use[] = array('id' => $row->id, 'user_nicename' => $row->user_nicename, 'user_role' => user_role_id_to_nicename($row->user_role));
}
$array['user'] = $array_use;
/* Tạo pagination */
$hmdb->Query(" SELECT * FROM " . DB_PREFIX . "users WHERE `user_group` = '{$user_group}' ");
$total_item = $hmdb->RowCount();
$total_page = ceil($total_item / $perpage);
$first = '1';
if ($request_paged > 1) {
$previous = $request_paged - 1;
} else {
$previous = $first;
}
if ($request_paged < $total_page) {
$next = $request_paged + 1;
} else {
$next = $total_page;
}
$array['pagination'] = array('first' => $first, 'previous' => $previous, 'next' => $next, 'last' => $total_page, 'total' => $total_item, 'paged' => $request_paged);
} else {
$array['user'] = array();
$array['pagination'] = array();
}
return hook_filter('user_show_data', json_encode($array, TRUE));
}
示例7: checkIfAlreayExistsGroupPrID
/**
* Metodo se già esiste il raggrupamento per immagine
*
* @param int $id_product Id del prodotto
* @return boolean TRUE se esiste, FALSE non c'è
*/
function checkIfAlreayExistsGroupPrID($id_product)
{
$sql = "SELECT * FROM erp_image_group WHERE id_product = {$id_product}";
$db = new MySQL();
$result = $db->QuerySingleRow($sql);
if ($db->RowCount() > 0) {
return TRUE;
} else {
return FALSE;
}
}
示例8: getIndirizzi
/**
* Metodo per a creazione del file di indirizzi (indirizzi fatturazione - spedizione)
*/
function getIndirizzi()
{
/*
* La richiesta � quella di gestire anche un 4� file, denominato FWINDIRIZZI, che contenga tutti gli indirizzi di spedizione.
*
*
*/
$query = "SELECT \n\t\tid_address,\n\t customer_code,\n\t\tcompany,\n\t\tfirstname,\n\t\tlastname,\n\t\tCONCAT(address1, ' ', address2) as full_address,\n\t\tpostcode,\n\t\tcity,\n\t\tstate_name,\n\t\tphone,\n\t\tphone_mobile,\n\t\tvat_number\n\t\t\n\t\tFROM ps_address \n\t\tLEFT JOIN (SELECT code as customer_code, id_customer from ps_customer) AS ps_customer_joined ON ps_customer_joined.id_customer = ps_address.id_customer\n\t\tLEFT JOIN (SELECT name as state_name, id_state from ps_state) as ps_state_joined ON ps_state_joined.id_state = ps_address.id_state\n\t\t\n\t\tWHERE ((synch = 0)AND(NOT(alias LIKE 'fatturazione')))";
$db = new MySQL();
$db->Query($query);
$row = NULL;
if ($db->RowCount() > 0) {
while (!$db->EndOfSeek()) {
$row[] = $db->Row();
}
}
foreach ($row as $anag) {
/* DOC: 2.1) TABELLA FWINDIRIZZI (1)
La tabella FWINDIRIZZI potr� avere un tracciato record ricavato da quello della tabella �ps_address� di Presta Shop:
Campo Valori Chiave Descrizione campo
ID_Address int si Numero univoco indirizzo
CdCustomer char(50) no Codice del cliente, ricavato dalla tabella ps_customer
Company char(64) no Ragione sociale
Cognome char(32) no Cognome, da concatenare con Nome e importare in DestDiv.Des2Dest
Nome char(32) no Vedi sopra
Address char(128) no Indirizzo
Zip char(12) no Codice Avviamento Postale
City char(64) no Localit�
NB. -> ripetizione. elimino => City char(64) no Localit�
Prov char(5) no Sigla Provincia, ricavato da ID_State o ID_Country ?
Phone char(32) no Telefono
PhoneMob char(32) no Cellulare, da importare in Contatto
VATnum char(32) no Partita IVA
*/
$stringa = null;
$stringa[] = $anag->id_address;
$stringa[] = $anag->customer_code;
$stringa[] = !empty($anag->company) ? $anag->company : "-Senza Ragione Sociale-";
$stringa[] = !empty($anag->lastname) ? $anag->lastname : "-Senza Cognome-";
$stringa[] = !empty($anag->firstname) ? $anag->firstname : "-Senza Nome-";
$stringa[] = !empty($anag->full_address) ? $anag->full_address : "-Senza Indirizzo-";
$stringa[] = $anag->postcode;
$stringa[] = $anag->city;
$stringa[] = $anag->state_name;
$stringa[] = $anag->phone;
$stringa[] = $anag->phone_mobile;
$stringa[] = !empty($anag->vat_number) ? $anag->vat_number : "-Senza Partita Iva-";
file_put_contents($this->fileFWINDIRIZZI, iconv(mb_detect_encoding(implode("§", $stringa), mb_detect_order(), true), "UTF-8", implode("§", $stringa)) . "\r\n", FILE_APPEND);
$this->setAnagraficaSynchronized($anag->id_address);
/*
$stringa = null;
$stringa[] = $this->fillCodeClientiWithZero($this -> getCodeClienti(), $anag -> id_customer);
// CDute [0]
$appo = null;
$appo = $this -> getSIngleAnagFromId($anag -> id_customer);
if (!empty($appo -> company)) {
$stringa[] = $appo -> company;
// DSRaso [1]
} else {
$stringa[] = "-Senza Ragione Sociale-";
}
if (!empty($anag -> lastname)) {
$stringa[] = $anag -> lastname;
// DSCognome [2]
} else {
$stringa[] = "-Senza Cognome-";
}
if (!empty($anag -> firstname)) {
$stringa[] = $anag -> firstname;
// DSnome [3]
} else {
$stringa[] = "-Senza Nome-";
}
if (!empty($appo -> vat_number)) {
$stringa[] = $appo -> vat_number;
// DSpiva [4]
} else {
$stringa[] = "-Senza Partita Iva-";
}
if (!empty($appo -> dni)) {
$stringa[] = $appo -> dni;
// DScod_fis [5]
} else {
$stringa[] = "-Senza Codice Fiscale-";
}
$stringa[] = $appo -> address1;
// DSindi [6]
$stringa[] = $appo -> postcode;
// DScap [7]
$stringa[] = $appo -> city;
// DSloca [8]
$stringa[] = $this -> getStateFromId($appo -> id_state);
//$stringa[] = ""; // DSprov [9]
$stringa[] = $appo -> phone;
// DStel [10]
//.........这里部分代码省略.........
示例9:
if ($db->Query($sql)) {
$db->TransactionEnd();
echo "Last ID inserted was: " . $db->GetLastInsertID() . "<br /><br />\n";
} else {
$db->TransactionRollback();
echo "<p>Query Failed</p>\n";
}
// --- Query and show the data --------------------------------------
// (Note: $db->Query also returns the result set)
if ($db->Query("SELECT * FROM Test")) {
echo $db->GetHTML();
} else {
echo "<p>Query Failed</p>";
}
// --- Getting the record count is easy -----------------------------
echo "\n<p>Record Count: " . $db->RowCount() . "</p>\n";
// --- Loop through the records -------------------------------------
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";
}
示例10: query_content
//.........这里部分代码省略.........
$query_join .= " AND `object_id` IN (" . $query_content_key . ") ";
}
if ($query_in_taxonomy) {
$query_join .= " OR `object_id` IN (" . $query_in_taxonomy . ") ";
}
$query_join .= " OR `object_id` IN (" . $query_field . ") ";
break;
case 'and':
if ($query_content_key) {
$query_join .= " AND `object_id` IN (" . $query_content_key . ") ";
}
if ($query_in_taxonomy) {
$query_join .= " AND `object_id` IN (" . $query_in_taxonomy . ") ";
}
$query_join .= " AND `object_id` IN (" . $query_field . ") ";
break;
default:
if ($query_content_key) {
$query_join .= " AND `object_id` IN (" . $query_content_key . ") ";
}
if ($query_in_taxonomy) {
$query_join .= " AND `object_id` IN (" . $query_in_taxonomy . ") ";
}
$query_join .= " AND `object_id` IN (" . $query_field . ") ";
}
/** Kết thúc các query lấy các content id thỏa mãn yêu cầu */
/** Order theo 1 field và limit */
if (isset($args['order'])) {
$order_by = $args['order'];
} else {
$order_by = 'public_time,desc,number';
}
if (isset($args['limit'])) {
$limit = $args['limit'];
} else {
$limit = get_option(array('section' => 'system_setting', 'key' => 'post_per_page', 'default_value' => '12'));
}
if (isset($args['offset']) and is_numeric($args['offset'])) {
$offset = $args['offset'];
} else {
$offset = 0;
}
if (isset($args['paged'])) {
$paged = $args['paged'];
} else {
$paged = get_current_pagination();
}
$paged = $paged - 1;
if ($paged < 0) {
$paged = 0;
}
/** Tạo query ORDER */
$ex = explode(',', $order_by);
$ex = array_map("trim", $ex);
$order_field = $ex[0];
$order = strtoupper($ex[1]);
if (isset($ex[2])) {
$numerically = $ex[2];
} else {
$numerically = FALSE;
}
if ($numerically == 'number') {
$order_query = " AND `name` = '" . $order_field . "' ORDER BY CAST(val AS unsigned) " . $order . " ";
} else {
$order_query = " AND `name` = '" . $order_field . "' ORDER BY `val` " . $order . " ";
}
/** Tạo query LIMIT */
if (is_numeric($limit)) {
$limit_query = " LIMIT {$limit} ";
} else {
$limit_query = '';
}
/** Tạo query OFFSET */
if ($limit == FALSE) {
$offset_query = '';
} else {
$offset_query_page = $paged * $limit;
$offset_query_page = $offset_query_page + $offset;
$offset_query = " OFFSET {$offset_query_page} ";
}
/** Tạo câu lệnh select từ chuỗi các id thỏa mãn */
$result = array();
$sql = "SELECT `object_id`" . " FROM `" . DB_PREFIX . "field`" . " WHERE `object_type` = 'content'" . " " . $query_join . " " . " " . $order_query . " ";
$hmdb->Query($sql);
$total_result = $hmdb->RowCount();
$sql = "SELECT `object_id`" . " FROM `" . DB_PREFIX . "field`" . " WHERE `object_type` = 'content'" . " " . $query_join . " " . " " . $order_query . " " . $limit_query . " " . $offset_query . " ";
$hmdb->Query($sql);
$base = get_current_uri();
if ($base == '') {
$base = '/';
}
$hmcontent->set_val(array('key' => 'total_result', 'val' => $total_result));
$hmcontent->set_val(array('key' => 'paged', 'val' => $paged + 1));
$hmcontent->set_val(array('key' => 'perpage', 'val' => $limit));
$hmcontent->set_val(array('key' => 'base', 'val' => $base));
while ($row = $hmdb->Row()) {
$result[] = $row->object_id;
}
return $result;
}
示例11: checkIfAnagraficaFatturazioneEsiste
function checkIfAnagraficaFatturazioneEsiste($vs_code)
{
$sql = "SELECT * FROM ps_address WHERE vs_code = '{$vs_code}' AND alias = 'fatturazione'";
$db = new MySQL();
$result = $db->QuerySingleRow($sql);
if ($db->RowCount() > 0) {
return $result->id_address;
} else {
return 0;
}
}
示例12: getCategoryShopLastPosition
/**
* Metodo utilizzato per recuperare ultimo valore di position all'interno della tabella ps_category_shop
*
* @return int $position Ultimo valore di position presente
*/
function getCategoryShopLastPosition()
{
$db = new MySQL();
$sql = "SELECT position FROM ps_category_shop WHERE id_category > 2 ORDER BY position DESC";
$result = $db->QuerySingleRow($sql);
if ($db->RowCount() > 0) {
return $result->position + 1;
} else {
return 1;
}
}
示例13: thumbnail_media
/** Trả về link thumbnail của file */
function thumbnail_media($id)
{
$hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
if (isset($id) and is_numeric($id)) {
$tableName = DB_PREFIX . "media";
$whereArray = array('id' => MySQL::SQLValue($id));
$hmdb->SelectRows($tableName, $whereArray);
$rowCount = $hmdb->RowCount();
if ($rowCount != 0) {
$row = $hmdb->Row();
$file_info = $row->file_info;
$file_name = $row->file_name;
$file_folder = $row->file_folder;
if ($file_folder != '/') {
$file_folder = '/' . $file_folder . '/';
}
$file_info = json_decode($file_info, TRUE);
if ($file_info['file_is_image'] == TRUE) {
$thumbnail_src = SITE_URL . FOLDER_PATH . HM_CONTENT_DIR . '/uploads' . $file_folder . $file_info['thumbnail'];
} else {
$file_src_name_ext = strtolower($file_info['file_src_name_ext']);
$file_ext_icon = './' . HM_CONTENT_DIR . '/icon/fileext/' . $file_src_name_ext . '.png';
if (file_exists($file_ext_icon)) {
$thumbnail_src = SITE_URL . FOLDER_PATH . HM_CONTENT_DIR . '/icon/fileext/' . $file_src_name_ext . '.png';
} else {
$thumbnail_src = SITE_URL . FOLDER_PATH . HM_CONTENT_DIR . '/icon/fileext/blank.png';
}
}
return $thumbnail_src;
}
}
}
示例14: json_encode
}
// getting total number records without any search
$sql = "SELECT * FROM `employee` ";
$sqlTot .= $sql;
$sqlRec .= $sql;
//concatenate search sql if value exist
if (isset($where) && $where != '') {
$sqlTot .= $where;
$sqlRec .= $where;
}
$sqlRec .= " ORDER BY " . $columns[$params['order'][0]['column']] . " " . $params['order'][0]['dir'] . " LIMIT " . $params['start'] . " ," . $params['length'] . " ";
if (!$db->Query($sqlTot)) {
$db->Kill($db->Error());
}
//$queryTot = mysqli_query($conn, $sqlTot) or die("database error:". mysqli_error($conn));
$totalRecords = $db->RowCount();
//$totalRecords = mysqli_num_rows($queryTot);
if (!$db->Query($sqlRec)) {
$db->Kill($db->Error());
}
//$queryRecords = mysqli_query($conn, $sqlRec) or die("error to fetch employees data");
//iterate on results row and create new index array of data
while (!$db->EndOfSeek()) {
$row = $db->RowValue();
$data[] = $row;
}
//while( $row = mysqli_fetch_row($queryRecords) ) {
//$data[] = $row;
//}
$json_data = array("draw" => intval($params['draw']), "recordsTotal" => intval($totalRecords), "recordsFiltered" => intval($totalRecords), "data" => $data);
echo json_encode($json_data);
示例15: MySQL
<?php
include "Mysql.php";
echo "<hr>";
try {
$filter["ALUNO_NOME"] = MySQL::SQLValue('%');
$db = new MySQL();
if (!$db) {
echo " bd não instanciado! <br><br>";
} else {
echo " bd instanciado.<br><br>";
}
$db->SelectRows("ALUNO");
if ($db->RowCount() > 0) {
echo "Conectado.<br><br><hr>";
}
echo "<br>Tabela: aluno <p>";
echo $db->GetHTML();
echo '<br><br>';
$db->Close();
} catch (Exception $e) {
echo "Erro: ", $e->getMessage(), "\n";
}
echo "<hr>";
try {
//$filter["ALUNO_NOME"] = MySQL::SQLValue('%');
//exibir tabela MATERIA
echo "Tabela: materia <p>";
$db->SelectRows("MATERIA");
echo $db->GetHTML();
echo '<br><br>';