本文整理汇总了PHP中_mysql_fetch_object函数的典型用法代码示例。如果您正苦于以下问题:PHP _mysql_fetch_object函数的具体用法?PHP _mysql_fetch_object怎么用?PHP _mysql_fetch_object使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_mysql_fetch_object函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_mysql_count
function get_mysql_count($hr_class)
{
$result = _mysql_query("select count(id) as count from workunit where hr_class=" . $hr_class);
$count = _mysql_fetch_object($result);
_mysql_free_result($result);
return $count->count;
}
示例2: delete_user
function delete_user($user)
{
if (!empty($user->teamid)) {
user_quit_team($user);
}
if ($user->has_profile) {
_mysql_query("DELETE FROM profile WHERE userid = {$user->id}");
delete_user_pictures($user->id);
_mysql_query("UPDATE user SET has_profile=0 WHERE id={$user->id}");
}
if ($user->total_credit > 0.0) {
error_page("Cannot delete user: User has credit.");
return false;
}
// Don't delete user if they have any outstanding Results
//
$q = "SELECT COUNT(*) AS count FROM result WHERE userid=" . $user->id;
$result = _mysql_query($q);
$c = _mysql_fetch_object($result);
_mysql_free_result($result);
if ($c->count) {
error_page("Cannot delete user: User has {$c->count} results in the database.");
}
// Don't delete user if they have posted to the forums
//
$q = "SELECT COUNT(*) AS count FROM post WHERE user=" . $user->id;
$result = _mysql_query($q);
$c = _mysql_fetch_object($result);
_mysql_free_result($result);
if ($c->count) {
error_page("Cannot delete user: User has {$c->count} forum posts.");
}
$q = "DELETE FROM user WHERE id=" . $user->id;
$result = _mysql_query($q);
}
示例3: do_app
function do_app($app)
{
// enumerate the host_app_versions for this app,
// joined to the host
$db = BoincDb::get();
$query = "select et_avg, host.on_frac, host.active_frac, host.gpu_active_frac, app_version.plan_class " . " from DBNAME.host_app_version, DBNAME.host, DBNAME.app_version " . " where host_app_version.app_version_id = app_version.id " . " and app_version.appid = {$app->id} " . " and et_n > 0 and et_avg > 0 " . " and host.id = host_app_version.host_id";
$result = $db->do_query($query);
$a = array();
while ($x = _mysql_fetch_object($result)) {
if (is_gpu($x->plan_class)) {
$av = $x->on_frac;
if ($x->gpu_active_frac) {
$av *= $x->gpu_active_frac;
} else {
$av *= $x->active_frac;
}
} else {
$av = $x->on_frac * $x->active_frac;
}
$a[] = 1 / $x->et_avg * $av;
}
_mysql_free_result($result);
sort($a);
$n = count($a);
$f = fopen("../../size_census_" . $app->name, "w");
for ($i = 1; $i < $app->n_size_classes; $i++) {
$k = (int) ($i * $n / $app->n_size_classes);
fprintf($f, "%e\n", $a[$k]);
}
fclose($f);
}
示例4: user_permissions_form
function user_permissions_form()
{
global $special_user_bitfield;
page_head('Manage user privileges');
start_table();
row1("Current special users", 99);
echo "<tr><th>User</th>";
for ($i = 0; $i < S_NFLAGS; $i++) {
echo "<th>" . $special_user_bitfield[$i] . "</th>\n";
}
echo "<th> </th></tr>";
$result = _mysql_query("SELECT prefs.userid, prefs.special_user, user.id, user.name \n FROM forum_preferences as prefs, user \n WHERE CONVERT(special_user, DECIMAL) > 0 and prefs.userid=user.id");
$i = 0;
while ($foo = _mysql_fetch_object($result)) {
echo "<tr class=row{$i}>\n <td>{$foo->name} ({$foo->id})</td>\n <form action=\"user_permissions.php\" method=\"POST\">\n <input type=\"hidden\" name=\"userid\" value=\"{$foo->userid}\">\n ";
for ($j = 0; $j < S_NFLAGS; $j++) {
$bit = substr($foo->special_user, $j, 1);
$c = $bit == 1 ? "checked" : "";
echo "<td>\n <input type=\"checkbox\" name=\"role" . $j . "\" value=\"1\" {$c}>\n </td>\n ";
}
echo "<td><input class=\"btn btn-default\" type=\"submit\" value=\"Update\"></td>";
echo "</form></tr>\n";
$i = 1 - $i;
}
echo "\n <tr class=row{$i}>\n <form action=\"user_permissions.php\" method=\"POST\">\n <td>Add User ID:<input type=\"text\" name=\"userid\" size=\"6\"></td>\n ";
for ($j = 0; $j < S_NFLAGS; $j++) {
echo "<td>\n <input type=\"checkbox\" name=\"role" . $j . "\" value=\"1\">\n </td>\n ";
}
echo "<td>\n <input class=\"btn btn-default\" type=\"submit\" value=\"Update\">\n </td>\n </form>\n </tr>\n ";
end_table();
page_tail();
}
示例5: profile_word
function profile_word($word)
{
$q = "select userid from profile where response1 like '%{$word}%'";
echo "{$q}\n";
$r = _mysql_query($q);
while ($x = _mysql_fetch_object($r)) {
purge_user($x->userid);
}
}
示例6: update_4_18_2004
function update_4_18_2004()
{
do_query("alter table user add cross_project_id varchar(254) not null");
$result = do_query("select * from user");
while ($user = _mysql_fetch_object($result)) {
$x = random_string();
do_query("update user set cross_project_id='{$x}' where id={$user->id}");
}
}
示例7: show_graph
function show_graph()
{
db_init();
$xaxis = $_GET['xaxis'];
$yaxis = $_GET['yaxis'];
$granularity = $_GET['granularity'];
$active = $_GET['active'];
$inactive = $_GET['inactive'];
$show_text = $_GET['show_text'];
if (!$active && !$inactive) {
echo "You must select at least one of (active, inactive)";
exit;
}
$fields = 'host.id, user.create_time';
if ($xaxis == 'active' || !$active || !$inactive) {
$query = "select {$fields}, max(rpc_time) as max_rpc_time from host, user where host.userid=user.id group by userid";
} else {
$query = 'select $fields from user';
}
$result = _mysql_query($query);
$yarr = array();
$now = time();
$maxind = 0;
$active_thresh = time() - 30 * 86400;
while ($user = _mysql_fetch_object($result)) {
$val = $now - $user->max_rpc_time;
if (!$active) {
if ($user->max_rpc_time > $active_thresh) {
continue;
}
}
if (!$inactive) {
if ($user->max_rpc_time < $active_thresh) {
continue;
}
}
$life = $user->max_rpc_time - $user->create_time;
$ind = $life / $granularity;
$ind = (int) $ind;
$yarr[$ind]++;
if ($ind > $maxind) {
$maxind = $ind;
}
}
$xarr = array();
for ($i = 0; $i <= $maxind; $i++) {
$xarr[$i] = $i;
if (is_null($yarr[$i])) {
$yarr[$i] = 0;
}
}
if ($show_text) {
show_text($xarr, $yarr);
} else {
draw_graph($xarr, $yarr);
}
}
示例8: update_thread_timestamps
function update_thread_timestamps()
{
$threads = BoincThread::enum();
foreach ($threads as $thread) {
$q = "select max(timestamp) as foo from post where thread={$thread->id}";
$r2 = _mysql_query($q);
$m = _mysql_fetch_object($r2);
echo "id: {$thread->id}; min: {$m->foo}\n";
_mysql_free_result($r2);
$n = $m->foo;
if ($n) {
$q = "update thread set timestamp={$n} where id={$thread->id}";
_mysql_query($q);
}
}
}
示例9: get_data
function get_data()
{
$nwus = 4000;
$sum = array();
for ($i = 0; $i <= 10; $i++) {
$sum[] = 0;
}
$r1 = _mysql_query("select id from workunit where canonical_resultid>0 limit {$nwus}");
$n = 0;
while ($wu = _mysql_fetch_object($r1)) {
$results = array();
$r2 = _mysql_query("select * from result where workunitid={$wu->id}");
$found_zero = false;
while ($result = _mysql_fetch_object($r2)) {
if ($result->granted_credit == 0) {
continue;
}
// skip invalid
$host = BoincHost::lookup_id($result->hostid);
$r = new StdClass();
$r->cpu_time = $result->cpu_time;
$r->p_fpops = $host->p_fpops;
$r->p_iops = $host->p_iops;
$results[] = $r;
}
//echo "Wu $wu->id -------------\n";
if (count($results) < 2) {
continue;
}
for ($i = 0; $i <= 10; $i++) {
$fpw = $i / 10.0;
$sum[$i] += fpw_var($results, $fpw);
}
$n++;
}
echo "This script recommends value for <fp_benchmark_weight> in config.xml.\nIt does this by finding the value that minimizes the variance\namong claimed credit for workunits currently in your database.\nIt examines at most {$nwus} WUs (edit the script to change this).\n\nNumber of workunits analyzed: {$n}\n\n";
for ($i = 0; $i <= 10; $i++) {
$fpw = $i / 10.0;
$r = $sum[$i] / $n;
echo "FP weight {$fpw}: variance is {$r}\n";
if ($i == 0) {
$best = $r;
$fbest = $fpw;
} else {
if ($r < $best) {
$best = $r;
$fbest = $fpw;
}
}
}
echo "\nRecommended value: {$fbest}\n";
}
示例10: admin_page_head
admin_page_head("screen profiles");
if (function_exists('profile_screen_query')) {
$query = profile_screen_query();
} else {
if (profile_screening()) {
$query = "select * from profile, user where profile.userid=user.id " . " and has_picture>0 " . " and verification=0 " . " limit 20";
} else {
$query = "select * from profile, user where profile.userid=user.id " . " and has_picture>0 " . " and verification=0 " . " and uotd_time is null " . " and expavg_credit>1 " . " and (response1 <> '' or response2 <> '') " . " order by recommend desc limit 20";
}
}
$result = _mysql_query($query);
$n = 0;
echo "<form action=profile_screen_action.php>\n";
start_table();
$found = false;
while ($profile = _mysql_fetch_object($result)) {
$found = true;
echo "<tr><td valign=top>";
buttons($n);
echo "\n <br>Name: {$profile->name}\n <br>recommends: {$profile->recommend}\n <br>rejects: {$profile->reject}\n <br>RAC: {$profile->expavg_credit}\n <br>\n ";
echo "</td><td><table border=2> ";
show_profile($profile, $g_logged_in_user, true);
echo "</table></td></tr>\n";
echo "<input type=\"hidden\" name=\"userid{$n}\" value=\"{$profile->userid}\">\n";
$n++;
}
end_table();
if ($found) {
echo "\n <input type=\"hidden\" name=\"n\" value=\"{$n}\">\n <input type=\"submit\" value=\"OK\">\n ";
} else {
echo "No more profiles to screen.";
示例11: fix_fix
function fix_fix()
{
$profiles = _mysql_query("select * from profile where id=99");
$profile = _mysql_fetch_object($profiles);
fix_profile($profile);
}
示例12: db_init
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
require_once '../inc/forum.inc';
require_once '../inc/util_ops.inc';
db_init();
admin_page_head('Manage user privileges');
start_table("align=\"center\"");
row1("Current special users", '9');
echo "<tr><td>User</td>";
for ($i = 0; $i < S_NFLAGS; $i++) {
echo "<td width=\"15\">" . $special_user_bitfield[$i] . "</td>\n";
}
echo "</tr>";
$result = _mysql_query("SELECT prefs.userid, prefs.special_user, user.id, user.name \n FROM forum_preferences as prefs, user \n WHERE CONVERT(special_user, DECIMAL) > 0 and prefs.userid=user.id");
for ($i = 1; $i <= _mysql_num_rows($result); $i++) {
$foo = _mysql_fetch_object($result);
echo "<form action=\"manage_special_users_action.php\" method=\"POST\">\n";
echo "<input type=\"hidden\" name=\"userid\" value=\"{$foo->userid}\"\n <tr><td>{$foo->name} ({$foo->id})</td>\n ";
for ($j = 0; $j < S_NFLAGS; $j++) {
$bit = substr($foo->special_user, $j, 1);
echo "<td><input type=\"checkbox\" name=\"role" . $j . "\" value=\"1\"";
if ($bit == 1) {
echo " checked=\"checked\"";
}
echo "></td>\n";
}
echo "<td><input class=\"btn btn-default\" type=\"submit\" value=\"Update\"></form></td>";
echo "</tr>\n";
}
echo "<tr><form action=\"manage_special_users_action.php\" method=\"POST\">\n";
echo "<td>Add UserID:<input type=\"text\" name=\"userid\" size=\"6\"></td>";
示例13: fix_fix
function fix_fix()
{
$posts = _mysql_query("select * from post where id=99");
$post = _mysql_fetch_object($posts);
fix_post($post);
}
示例14: do_lapsed
function do_lapsed()
{
global $globals;
$max_last_rpc_time = time() - $globals->lapsed_interval;
// the following is an efficient way of getting the list of
// users for which no host has done an RPC recently
//
$result = _mysql_query("select userid from host group by userid having max(rpc_time)<{$max_last_rpc_time};");
while ($host = _mysql_fetch_object($result)) {
$uresult = _mysql_query("select * from user where id = {$host->userid};");
$user = _mysql_fetch_object($uresult);
_mysql_free_result($uresult);
if (!$user) {
echo "Can't find user {$host->userid}\n";
continue;
}
handle_user($user, 'lapsed');
}
_mysql_free_result($result);
}
示例15: find_oldest
function find_oldest()
{
$result = _mysql_query("select name,create_time from result where server_state=2 order by create_time limit 1");
$x = _mysql_fetch_object($result);
return $x->create_time;
}