本文整理汇总了PHP中rows函数的典型用法代码示例。如果您正苦于以下问题:PHP rows函数的具体用法?PHP rows怎么用?PHP rows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
public function load(){
if(!$this->id){
//print "loading a ".$this->className." without id<br>";
$testRes = $this->db->get_where($this->table, $this->buildNameValueArray($this->dataFields));
//print_query($this->db);
if(rows($testRes)){
$thisFromDb = $testRes->row_array();
$this->id = $thisFromDb['id'];
unset($thisFromDb['id']);
$this->initialData = $thisFromDb;
}
}else{
if($cachedObj = $this->cache->hasCache(get_class($this),$this->id)){
//print "loading a ".$this->className." from cache with id: ".$this->id."<br>";
$this->setAtributes($cachedObj->buildNameValueArray());
return;
}else{
//print "loading a ".$this->className." with id: ".$this->id."<br>";
$testRes = $this->db->get_where($this->table, array("id"=>$this->id));
if(rows($testRes)){
$this->setAtributes($testRes->row_array());
$this->cache->add($this);
}
}
$this->initialData = $this->buildNameValueArray();
}
}
示例2: buildElementLocations
private function buildElementLocations(){
$elementLocations = $this->db->get_where("elementLocations",array("element_id"=>$this->id));
if(rows($elementLocations)){
foreach($elementLocations->result_array() as $curElementLocation){
$this->elementlocations[$curElementLocation['id']] = new ElementLocation( $this->db,$curElementLocation['id']);
}
}
}
示例3: buildLocations
function buildLocations($oh){
$locations = $oh->db->get("locations");
$locationsArray = array();
if(rows($locations))
foreach($locations->result_array() as $curLocation){
$locationsArray[$curLocation['id']] = new Location($oh, $curLocation['id']);
}
return $locationsArray;
}
示例4: getNewRevisionNumber
private function getNewRevisionNumber($obj_id,$obj_type){
$rev = 1;
$result = $this->db->query("SELECT `revision` FROM `history` WHERE `obj_id` = '".$obj_id."' AND `obj_type` = '".$obj_type."' ORDER BY `revision` DESC");
if(rows($result)){
$rev = getFirst($result);
$rev = (int)$rev['revision'] + 1;
}
return $rev;
}
示例5: buildOffsetrules
function buildOffsetrules()
{
$rules = $this->db->get_where("offsetrules", array("map_id" => $this->id));
if (rows($rules)) {
foreach ($rules->result_array() as $curRule) {
$this->offsetrules[$curRule['id']] = new Offsetrule($this->db, $curRule['id']);
}
}
$this->offsetrules[] = new Offsetrule($this->db);
}
示例6: createAdmin
function createAdmin()
{
if ($this->config->item('AUTH_METHOD') == "INTERNAL") {
$dbchk = $this->db->where('user', 'admin')->get('users');
if ($dbchk->num - rows() == 0) {
$dti = array("user" => "admin", "password" => sha1($this->config->item('ADMIN_PASSWORD')), 'gids' => '1,2,3', 'id' => 1);
$this->db->insert('users', $dti);
echo "Admin user created.";
} else {
echo "The admin account already exists.";
}
} else {
echo "This site is not configured to use internal auth.";
}
}
示例7: load
function load(){
if($this->map_id){
$testRes = $this->db->get_where($this->origin_table,array("map_id"=>$this->map_id));
if(rows($testRes)){
foreach($testRes->result_array() as $curRow){
$this->origins[] = $curRow['location_id'];
}
}
$testRes = $this->db->get_where($this->destination_table,array("map_id"=>$this->map_id));
if(rows($testRes)){
foreach($testRes->result_array() as $curRow){
$this->destinations[] = $curRow['location_id'];
}
}
}
}
示例8: load
function load(){
if(!$this->id){
$testRes = $this->db->get_where($this->table,array("element_id"=>$this->element_id,"name_id"=>$this->name_id));
if(rows($testRes)){
$thisFromDb = $testRes->row_array();
$this->id = $thisFromDb['id'];
}
}else{
$testRes = $this->db->get_where($this->table,array("id"=>$this->id));
if(rows($testRes)){
$thisFromDb = $testRes->row_array();
$this->element_id = $thisFromDb['element_id'];
$this->name_id = $thisFromDb['name_id'];
}
}
}
示例9: load
function load(){
if(!$this->id){
$testRes = $this->db->get_where($this->table,array("element_id"=>$this->element->id,"season_id"=>$this->season->id,"location_id"=>$this->location->id,"identifier"=>$this->identifier));
if(rows($testRes)){
$thisFromDb = $testRes->row_array();
$this->id = $thisFromDb['id'];
}
}else{
$testRes = $this->db->get_where($this->table,array("id"=>$this->id));
if(rows($testRes)){
$thisFromDb = $testRes->row_array();
$this->identifier = $thisFromDb['identifier'];
$this->seasonsize = $thisFromDb['seasonsize'];
$this->element = new SimpleElement($this->db, $thisFromDb['element_id']);
$this->season = new Season($this->db, $thisFromDb['season_id']);
$this->location = new Location($this->db, $thisFromDb['location_id']);
}
}
}
示例10: dm_frontend_page_type
function dm_frontend_page_type($page)
{
$downloads = rows('select name,filename,count from ' . DB_PREFIX . 'downloadManager where page_id=' . $page['id']);
$page_content = stripslashes($page['content']);
if (count($downloads) == 0) {
return $page_content;
}
$content = '<h1>Downloads</h1><div id="download-manager-content">
<table id="config-table" class="row-color">
<col width="50%"/>
<col width="50%"/>
<tr><th colspan="2">Downloads</th></tr>';
foreach ($downloads as $download) {
$content .= '<tr><td><a href="' . SITE_URL . '_plugins/Download-Manager/frontend/download.php?filename=' . $download['filename'] . '">' . $download['name'] . '</a></td><td><strong>' . $download['count'] . '</strong> Downloads</td></tr>';
}
$content .= '<tr><th colspan="2"> </th></tr>
</table></div><br/>' . $page_content;
return $content;
}
示例11: __construct
/**
* __construct
*
* sets up the class, fetches content area
* info from the db
*/
public function __construct()
{
$registered = rows('select * from ' . DB_PREFIX . 'content_areas');
$reg = array();
/**
* add registered content areas to $this->registered
*/
if (!empty($registered)) {
for ($i = 0; $i < count($registered); ++$i) {
$name = $registered[$i]['name'];
$reg[$name] = array();
foreach ($registered[$i] as $area => $val) {
if ($area == 'data' || $area == 'content') {
$reg[$name][$area] = json_decode($val, true);
continue;
}
$reg[$name][$area] = $val;
}
}
}
$this->registered = $reg;
/**
* get all widgets from plugins
*/
$widgets = array();
$Plugins = Plugins::getInstance();
foreach ($Plugins->plugins() as $plugin) {
if (isset($plugin['admin']['content_area_widgets']) && isset($plugin['frontend']['content_area_widgets'])) {
$admin = $plugin['admin']['content_area_widgets'];
$frontend = $plugin['frontend']['content_area_widgets'];
foreach ($admin as $widget) {
$widgets[$widget['name']]['admin'] = $widget['function'];
}
foreach ($frontend as $widget) {
$widgets[$widget['name']]['frontend'] = $widget['function'];
}
}
}
$this->widgets = $widgets;
}
示例12: build
private function build($type,$id){
if(endswith($type,"s")){
$table = $type;
$name = substr($type,0,-1);
}else{
$table = $type."s";
$name = $type;
}
$rows = $this->db->get_where($table,array("element_id"=>$id));
if(rows($rows)){
$out = array();
foreach($rows->result_array() as $curRow){
$out[$curRow['id']] = new $name( $this->oh, $curRow['id']);
}
$this->objArrays[$table] = $out;
return $out;
}else
return array();
}
示例13: load
function load()
{
if (!$this->id) {
$testRes = $this->db->get_where($this->table, array("map_id" => $this->map_id, "season_from" => $this->season_from, "season_to" => $this->season_to, "season_offset" => $this->season_offset, "episode_from" => $this->episode_from, "episode_to" => $this->episode_to, "episode_offset" => $this->episode_offset, "absolute_episode_offset" => $this->absolute_episode_offset));
if (rows($testRes)) {
$thisFromDb = $testRes->row_array();
$this->id = $thisFromDb['id'];
}
} else {
$testRes = $this->db->get_where($this->table, array("id" => $this->id));
if (rows($testRes)) {
$thisFromDb = $testRes->row_array();
$this->map_id = $thisFromDb['map_id'];
$this->season_from = $thisFromDb['season_from'];
$this->season_to = $thisFromDb['season_to'];
$this->season_offset = $thisFromDb['season_offset'];
$this->episode_from = $thisFromDb['episode_from'];
$this->episode_to = $thisFromDb['episode_to'];
$this->episode_offset = $thisFromDb['episode_offset'];
$this->absolute_episode_offset = $thisFromDb['absolute_episode_offset'];
}
}
}
示例14: rows
}
});
});
</script>
<div id="tabs">
<ul>
<li><a href="#tabs-1">Download Items</a></li>
<li><a href="#tabs-2">Page Content</a></li>
<li><a href="/ajax.php?file=_plugins/Download-Manager/admin/new-item.php&page_id=' . $page_id . '">New Item</a></li>
</ul>
<div id="tabs-1">
<div id="tabs-content">
<table class="row-color">
<tr><th>Items</th><th>Downloads</th></tr>';
$downloads = rows('select name,count from ' . DB_PREFIX . 'downloadManager where page_id=' . $page_id);
if (count($downloads) == 0) {
echo 'No download items.';
} else {
foreach ($downloads as $download) {
echo '<tr><td>' . $download['name'] . '</td><td>' . $download['count'] . '</td></tr>';
}
}
echo ' </table>
</div>
</div>
<div id="tabs-2">
<div id="tabs-content">';
if ($page_id != 0) {
$Page = row('select content from ' . DB_PAGES . ' where id=' . $page_id);
$page_content = stripslashes($Page['content']);
示例15: stats_resort
*/
if (!defined('AJAX_LOADED') || !defined('AJAX_VERIFIED')) {
exit;
}
$query = @$_GET['query'];
function stats_resort($arr)
{
$sorted = array();
foreach ($arr as $ar) {
}
}
switch ($query) {
case 'today-total':
$data = array();
$views = rows('select ip,day(viewed) from ' . DB_PREFIX . 'stats where day(viewed)>(day(now())-10) and month(viewed)=month(now()) and year(viewed)=year(now())');
$unique = rows('select distinct ip,day(viewed) from ' . DB_PREFIX . 'stats where day(viewed)>(day(now())-10) and month(viewed)=month(now()) and year(viewed)=year(now())');
/**
* calculate dates
*/
$data['categories'] = array(date('D', strtotime('-9 days')), date('D', strtotime('-8 days')), date('D', strtotime('-7 days')), date('D', strtotime('-6 days')), date('D', strtotime('-5 days')), date('D', strtotime('-4 days')), date('D', strtotime('-3 days')), date('D', strtotime('-2 days')), date('D', strtotime('-1 day')), date('D'));
$data['views'] = array(array('name' => 'Total Views', 'data' => array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), array('name' => 'Unique Views', 'data' => array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)));
$today = (int) date('d');
foreach ($views as $row) {
$d = $today - $row['day(viewed)'];
$data['views'][0]['data'][$d]++;
}
$data['views'][0]['data'] = array_reverse($data['views'][0]['data']);
foreach ($unique as $row) {
$d = $today - $row['day(viewed)'];
$data['views'][1]['data'][$d]++;
}