当前位置: 首页>>代码示例>>PHP>>正文


PHP mysql::fetchObject方法代码示例

本文整理汇总了PHP中mysql::fetchObject方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql::fetchObject方法的具体用法?PHP mysql::fetchObject怎么用?PHP mysql::fetchObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mysql的用法示例。


在下文中一共展示了mysql::fetchObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addtag

function addtag($id)
{
    if (!$id) {
        exit;
    }
    $mysqldb = new mysql();
    $mysqldb->connect();
    $mysqldb->select();
    $mysqldb->query("SELECT Keyw FROM articles WHERE FileID='{$id}'");
    $row = $mysqldb->fetchObject();
    $keystotags = $row->Keyw;
    // place keywords into tags table.
    $arrkeywords = explode(' ', $keystotags);
    foreach ($arrkeywords as $keyword) {
        if (strlen($keyword) > 4) {
            $mysqldb->query("INSERT INTO tags (fileid, tag) VALUES ('{$fileid}', '{$keyword}')");
        }
    }
}
开发者ID:rzs840707,项目名称:webapps_repository,代码行数:19,代码来源:functions.php

示例2: mysql

<?php

// a_authordetails.php -- Admin view Author Details
include './functions.php';
require_once './config/auth.php';
require './config/config.php';
include "./classes/mysql.class.php";
$mysqldb = new mysql();
$mysqldb->connect();
$mysqldb->select();
$authorid = mifi($_REQUEST[aid]);
$mysqldb->query("SELECT CONCAT(FirstName, ' ', LastName) AS name, Approved, UserName, Email, DATE_FORMAT(RegistrationDate, '%M %d, %Y') AS dr, (SELECT count(*) from articles WHERE Approved = 'N' AND AuthorID='{$authorid}') AS PendingArticles, (SELECT count(*) from articles WHERE Approved = 'Y' AND AuthorID='{$authorid}') AS ApprovedArticles, (SELECT count(*) from articles WHERE Approved = 'S' AND AuthorID='{$authorid}') AS SavedArticles FROM authors WHERE AuthorID='{$authorid}'");
$row = $mysqldb->fetchObject();
$totalarticles = $row->ApprovedArticles + $row->PendingArticles + $row->SavedArticles;
if (isset($_REQUEST['newperms'])) {
    $title = 'Permissions Updated';
} else {
    $title = 'Author details for ' . $row->name . ' (' . $row->UserName . ')';
}
$approved = $row->Approved;
if ($approved != 'Y') {
    $approved = "<a href=\"aufe2a.php?aid={$authorid}\">{$row->Approved}</a>";
}
head_page($title);
menu_options($title, $vnum, $viewop, $pid, $keys, $adfl);
contentinit($title);
echo <<<_AUTHORDETAILS
AuthorID : {$authorid}<br />
UserName : {$row->UserName}<br />
Full Name : {$row->name}<br />
Permissions : {$row->Approved}<br>
开发者ID:rzs840707,项目名称:webapps_repository,代码行数:31,代码来源:a_authordetails.php

示例3: CONCAT

    $start = 0;
}
$query = "SELECT CONCAT(au.LastName, ', ', au.FirstName) AS name, au.AuthorID, DATE_FORMAT(RegistrationDate, '%M %d, %Y') AS dr,(SELECT COUNT(*) FROM articles AS a WHERE a.AuthorID=au.AuthorID AND a.Approved='N' AND a.ParentID='0') AS pending, (SELECT COUNT(*) FROM articles AS a WHERE a.AuthorID=au.AuthorID AND a.Approved='S' AND a.ParentID='0') AS saved, (SELECT COUNT(*) FROM articles AS a WHERE a.AuthorID=au.AuthorID AND a.Approved='Y' AND a.ParentID='0') AS approved, (SELECT COUNT(*) FROM articles AS a WHERE a.AuthorID=au.AuthorID AND  a.ParentID='0') AS total FROM authors AS au";
$viewquery = $query . " LIMIT {$start}, {$display}";
// That's the end of our query making.
$mysqldb->query($query);
$num_records = $mysqldb->numRows($query);
$mysqldb->query($viewquery);
if ($num_records > $display) {
    // more than one page
    $num_pages = ceil($num_records / $display);
} else {
    $num_pages = 1;
}
$first = TRUE;
while ($row = $mysqldb->fetchObject()) {
    $bg = $bg == '#f5f5f5' ? '#cccccc' : '#f5f5f5';
    if ($first) {
        //name dr pending approved total
        echo <<<EOF
<table border="0" cellspacing="0" cellpadding="5" align="center" width="95%"><tr>
<td align="left" width = "30%"><small>Name</small></td>
<td align="right" width = "30%"><small>Register Date</small></td>
<td align = "left" width = "10%"><small>Pending</small></td>
<td align = "left" width = "10%"><small>Saved</small></td>
<td align = "left" width = "10%"><small>Approved</small></td>
<td align = "right" width = "10%"><small>Total</small></td></tr>
EOF;
    }
    echo "<tr bgcolor=\"{$bg}\"><td align=\"left\"><a href=\"a_authordetails.php?aid={$row->AuthorID}\">{$row->name}</a></td>\n\n<td align=\"right\"> {$row->dr}</td>\n\n<td align=\"center\"> {$row->pending}</td>\n<td align=\"center\"> {$row->saved}</td>\n<td align=\"center\"> {$row->approved}</td>\n<td align=\"center\"> {$row->total}</td>\n\n\n</tr>";
    $first = FALSE;
开发者ID:rzs840707,项目名称:webapps_repository,代码行数:31,代码来源:a_viewusers.php


注:本文中的mysql::fetchObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。