本文整理汇总了PHP中_mysql_query函数的典型用法代码示例。如果您正苦于以下问题:PHP _mysql_query函数的具体用法?PHP _mysql_query怎么用?PHP _mysql_query使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_mysql_query函数的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: get_db_info
function get_db_info($db_name)
{
// Carl grabbed this from the mysql.com boards http://dev.mysql.com/doc/refman/5.0/en/show-table-status.html
$result = _mysql_query("SHOW TABLE STATUS FROM {$db_name}");
// SQL output
// mysql> show table status from [table_name];
// | Name | Engine | Version | Row_format | Rows
// | Avg_row_length | Data_length | Max_data_length
// | Index_length | Data_free | Auto_increment | Create_time
// | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
//
$gdata = 0;
$gindex = 0;
$gtotal = 0;
$grows = 0;
$i = 0;
$db_rec = array();
while ($myarr = _mysql_fetch_assoc($result)) {
// sum grand totals
$total = $myarr["Data_length"] + $myarr["Index_length"];
$gindex += $myarr["Index_length"];
$gdata += $myarr["Data_length"];
$grows += $myarr["Rows"];
$gtotal += $total;
$db_rec[$i] = new DB_REC($myarr["Name"], $myarr["Data_length"], $myarr["Index_length"], $total, $myarr["Rows"], $myarr["Avg_row_length"]);
$i++;
}
$db_rec[$i] = new DB_REC("Total", $gdata, $gindex, $gtotal, $grows, "");
return $db_rec;
}
示例3: make_user
function make_user($user)
{
$prefs = $user->global_prefs;
$run_on_batteries = parse_boolint($prefs, "run_on_batteries");
$run_if_user_active = parse_boolint($prefs, "run_if_user_active");
$start_hour = parse_num($prefs, "<start_hour>");
$end_hour = parse_num($prefs, "<end_hour>");
$net_start_hour = parse_num($prefs, "<net_start_hour>");
$net_end_hour = parse_num($prefs, "<net_end_hour>");
$leave_apps_in_memory = parse_boolint($prefs, "leave_apps_in_memory");
$confirm_before_connecting = parse_boolint($prefs, "confirm_before_connecting");
$hangup_if_dialed = parse_boolint($prefs, "hangup_if_dialed");
$work_buf_min_days = parse_num($prefs, "<work_buf_min_days>");
$max_cpus = parse_num($prefs, "<max_cpus>");
$cpu_scheduling_period_minutes = parse_num($prefs, "<cpu_scheduling_period_minutes>");
$disk_interval = parse_num($prefs, "<disk_interval>");
$disk_max_used_gb = parse_num($prefs, "<disk_max_used_gb>");
$disk_max_used_pct = parse_num($prefs, "<disk_max_used_pct>");
$disk_min_free_gb = parse_num($prefs, "<disk_min_free_gb>");
$vm_max_used_pct = parse_num($prefs, "<vm_max_used_pct>");
$idle_time_to_run = parse_num($prefs, "<idle_time_to_run>");
$max_bytes_sec_up = parse_num($prefs, "<max_bytes_sec_up>");
$max_bytes_sec_down = parse_num($prefs, "<max_bytes_sec_down>");
$query = "insert into puser values\n ({$user->id},\n {$user->create_time},\n '{$user->email_addr}',\n '{$user->country}',\n {$user->total_credit},\n '{$user->venue}',\n {$run_on_batteries},\n {$run_if_user_active},\n {$start_hour},\n {$end_hour},\n {$net_start_hour},\n {$net_end_hour},\n {$leave_apps_in_memory},\n {$confirm_before_connecting},\n {$hangup_if_dialed},\n {$work_buf_min_days},\n {$max_cpus},\n {$cpu_scheduling_period_minutes},\n {$disk_interval},\n {$disk_max_used_gb},\n {$disk_max_used_pct},\n {$disk_min_free_gb},\n {$vm_max_used_pct},\n {$idle_time_to_run},\n {$max_bytes_sec_up},\n {$max_bytes_sec_down})\n ";
$retval = _mysql_query($query);
if (!$retval) {
echo _mysql_error();
}
}
示例4: _TOY_shamei_info
function _TOY_shamei_info($prms)
{
$q = "SELECT * FROM shamei WHERE catalog = '" . $prms['catalog'] . "' AND catalog_code = '" . $prms['catalog_code'] . "';";
$r_q = _mysql_query($q);
// выполним
$res = mysql_fetch_array($r_q, MYSQL_ASSOC);
return $res;
}
示例5: 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);
}
}
示例6: 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);
}
}
示例7: get_count_from_db
function get_count_from_db()
{
$result = _mysql_query("select count(*) from result");
if (!$result) {
return false;
}
$count = _mysql_fetch_array($result);
_mysql_free_result($result);
return $count[0];
}
示例8: do_query
function do_query($query)
{
echo "Doing query:\n{$query}\n";
$result = _mysql_query($query);
if (!$result) {
echo "Failed:\n" . _mysql_error() . "\n";
} else {
echo "Success.\n";
}
}
示例9: clean_user
function clean_user($user)
{
if ($user->name != sanitize_tags($user->name)) {
$x = sanitize_tags($user->name);
echo "ID: {$user->id}\nname: {$user->name}\nstripped name: {$x}\nemail: {$user->email_addr}\n-----\n";
$x = boinc_real_escape_string($x);
$x = trim($x);
$query = "update user set name='{$x}' where id={$user->id}";
$retval = _mysql_query($query);
echo $query;
}
}
示例10: getSingleQuery
function getSingleQuery($query)
{
$result = _mysql_query($query);
if (!$result) {
return;
}
$cnt = _mysql_fetch_row($result);
if (!$cnt) {
return;
}
_mysql_free_result($result);
return $cnt[0];
}
示例11: delete_user
function delete_user($user)
{
global $test;
$age = (time() - $user->create_time) / 86400;
echo "----------------\ndeleting user {$user->id} email {$user->email_addr} name {$user->name} age {$age} days\n";
if ($test) {
return;
}
delete_profile($user);
forum_delete_user($user);
BoincPrivateMessage::delete_aux("userid={$user->id} or senderid={$user->id}");
BoincNotify::delete_aux("userid={$user->id}");
$q = "delete from user where id={$user->id}";
_mysql_query($q);
}
示例12: user_permissions_action
function user_permissions_action()
{
$bitset = '';
for ($i = 0; $i < S_NFLAGS; $i++) {
if (post_int("role" . $i, TRUE) == 1) {
$bitset .= '1';
echo "<br> setting {$i}";
} else {
$bitset .= '0';
}
}
$userid = post_int("userid");
$query = "UPDATE forum_preferences SET special_user='{$bitset}' WHERE userid={$userid}";
_mysql_query($query);
Header("Location: user_permissions.php");
}
示例13: 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);
}
}
}
示例14: showTableStatus
function showTableStatus($db)
{
$size = 0;
$out = "";
start_table();
row1($db, 15);
row_array(array("Name", "Engine", "Version", "Row Format", "Rows", "Avg Row Length (KB)", "Data Length (MB)", "Max Data Length (MB)", "Index Length (MB)", "Data free (MB)", "Create Time", "Update Time", "Check Time", "Create Options", "Comment"));
_mysql_select_db($db);
$result = _mysql_query("show table status");
while ($row = _mysql_fetch_array($result)) {
$size += $row["Data_length"] + $row["Index_length"];
$engine = $row["Engine"];
if (!$engine) {
$engine = $row["Type"];
}
row_array(array($row["Name"], $engine, $row["Version"], $row["Row_format"], $row["Rows"], round($row["Avg_row_length"] / 1024, 2), round($row["Data_length"] / (1024 * 1024), 2), round($row["Max_data_length"] / (1024 * 1024), 2), round($row["Index_length"] / (1024 * 1024), 2), round($row["Data_free"] / (1024 * 1024), 2), $row["Create_time"], $row["Update_time"], $row["Check_time"], $row["Create_options"], $row["Comment"]));
}
$size = round($size / 1024 / 1024, 1);
row2("Total Table Sizes (MB)", $size);
end_table();
echo "<BR><BR>";
}
示例15: recordLogin
public static function recordLogin()
{
//RECORD THIS USER LOGIN, into user_logs
$mysql['login_server'] = db::escape(serialize($_SERVER));
$mysql['login_session'] = db::escape(serialize($_SESSION));
$mysql['login_error'] = db::escape(serialize($error));
$mysql['ip_address'] = db::escape($_SERVER['REMOTE_ADDR']);
$mysql['login_time'] = time();
if ($error) {
$mysql['login_success'] = 0;
} else {
$mysql['login_success'] = 1;
}
//record everything that happend during this crime scene.
$user_log_sql = "INSERT INTO 202_users_log\r\n\t\t\t\t\t\t\t\t SET user_name='" . $mysql['user_name'] . "',\r\n\t\t\t\t\t\t\t\t\t\tuser_pass='" . $mysql['user_pass'] . "',\r\n\t\t\t\t\t\t\t\t\t\tip_address='" . $mysql['ip_address'] . "',\r\n\t\t\t\t\t\t\t\t\t\tlogin_time='" . $mysql['login_time'] . "',\r\n\t\t\t\t\t\t\t\t\t\tlogin_success = '" . $mysql['login_success'] . "',\r\n\t\t\t\t\t\t\t\t\t\tlogin_error='" . $mysql['login_error'] . "',\r\n\t\t\t\t\t\t\t\t\t\tlogin_server='" . $mysql['login_server'] . "',\r\n\t\t\t\t\t\t\t\t\t\tlogin_session='" . $mysql['login_session'] . "'";
$user_log_result = mysql_query($user_log_sql) or record_mysql_error($user_log_sql);
if (!$error) {
$ip_id = INDEXES::get_ip_id($_SERVER['HTTP_X_FORWARDED_FOR']);
$mysql['ip_id'] = mysql_real_escape_string($ip_id);
//update this users last login_ip_address
$user_sql = "\tUPDATE \t202_users\r\n SET\t\t\tuser_last_login_ip_id='" . $mysql['ip_id'] . "'\r\n WHERE \tuser_name='" . $mysql['user_name'] . "'\r\n AND \t\tuser_pass='" . $mysql['user_pass'] . "'";
$user_result = _mysql_query($user_sql);
}
}