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


PHP Sql_Fetch_row函数代码示例

本文整理汇总了PHP中Sql_Fetch_row函数的典型用法代码示例。如果您正苦于以下问题:PHP Sql_Fetch_row函数的具体用法?PHP Sql_Fetch_row怎么用?PHP Sql_Fetch_row使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: UserAttributeValue1

function UserAttributeValue1($kwlib,$value) {
  if ($value) {
    $res = Sql_Query("select value from keywordlibvalue where id = $value");
    $row = Sql_Fetch_row($res);
  } else {
    return "Invalid Attribute Index";
  }
  return $row[0];
}
开发者ID:radicaldesigns,项目名称:amp,代码行数:9,代码来源:userlib.php

示例2: UserAttributeValue

function UserAttributeValue($user = 0, $attribute = 0)
{
    # workaround for integration webbler/phplist
    global $table_prefix, $tables;
    if (!isset($table_prefix)) {
        $table_prefix = "phplist_";
    }
    if (!$user || !$attribute) {
        return;
    }
    if (isset($tables["attribute"])) {
        $att_table = $tables["attribute"];
        $user_att_table = $tables["user_attribute"];
    } else {
        $att_table = "attribute";
        $user_att_table = "user_attribute";
    }
    $att = Sql_Fetch_array_Query("select * from {$att_table} where id = {$attribute}");
    switch ($att["type"]) {
        case "checkboxgroup":
            #     print "select value from $user_att_table where userid = $user and attributeid = $attribute";
            $val_ids = Sql_Fetch_Row_Query("select value from {$user_att_table} where userid = {$user} and attributeid = {$attribute}");
            if ($val_ids[0]) {
                #       print '<br/>1 <b>'.$val_ids[0].'</b>';
                if (function_exists('cleancommalist')) {
                    $val_ids[0] = cleanCommaList($val_ids[0]);
                }
                ## make sure the val_ids as numbers
                $values = explode(',', $val_ids[0]);
                $ids = array();
                foreach ($values as $valueIndex) {
                    $iValue = sprintf('%d', $valueIndex);
                    if ($iValue) {
                        $ids[] = $iValue;
                    }
                }
                if (!sizeof($ids)) {
                    return '';
                }
                $val_ids[0] = join(',', $ids);
                #       print '<br/>2 <b>'.$val_ids[0].'</b>';
                $value = '';
                $res = Sql_Query("select {$table_prefix}" . "listattr_" . $att["tablename"] . ".name\n          from {$user_att_table},{$table_prefix}" . "listattr_" . $att["tablename"] . "\n          where {$user_att_table}" . ".userid = " . $user . " and\n          {$table_prefix}" . "listattr_" . $att["tablename"] . ".id in ({$val_ids['0']}) and\n          {$user_att_table}" . ".attributeid = " . $attribute);
                while ($row = Sql_Fetch_row($res)) {
                    $value .= $row[0] . "; ";
                }
                $value = substr($value, 0, -2);
            } else {
                $value = "";
            }
            break;
        case "select":
        case "radio":
            $res = Sql_Query("select {$table_prefix}" . "listattr_" . $att["tablename"] . ".name\n        from {$user_att_table},{$table_prefix}" . "listattr_" . $att["tablename"] . "\n        where {$user_att_table}" . ".userid = " . $user . " and\n        {$table_prefix}" . "listattr_" . $att["tablename"] . ".id = {$user_att_table}" . ".value and\n        {$user_att_table}" . ".attributeid = " . $attribute);
            $row = Sql_Fetch_row($res);
            $value = $row[0];
            break;
        default:
            $res = Sql_Query(sprintf('select value from %s where
        userid = %d and attributeid = %d', $user_att_table, $user, $attribute));
            $row = Sql_Fetch_row($res);
            $value = $row[0];
    }
    return stripslashes($value);
}
开发者ID:narareddy,项目名称:phplist3,代码行数:65,代码来源:userlib.php

示例3: getPageLock

function getPageLock()
{
    global $tables;
    $thispage = $GLOBALS["page"];
    $running_req = Sql_query("select now() - modified,id from " . $tables["sendprocess"] . " where page = \"{$thispage}\" and alive order by started desc");
    $running_res = Sql_Fetch_row($running_req);
    $waited = 0;
    while ($running_res[1]) {
        # a process is already running
        if ($running_res[0] > 600) {
            # some sql queries can take quite a while
            # process has been inactive for too long, kill it
            Sql_query("update {$tables["sendprocess"]} set alive = 0 where id = {$running_res['1']}");
        } else {
            output($GLOBALS['I18N']->get('A process for this page is already running and it was still alive') . ' ' . $running_res[0] . ' ' . $GLOBALS['I18N']->get('seconds ago'));
            sleep(1);
            # to log the messages in the correct order
            if ($GLOBALS["commandline"]) {
                output("Running commandline, quitting. We'll find out what to do in the next run.");
                exit;
            }
            output($GLOBALS['I18N']->get('Sleeping for 20 seconds, aborting will quit'));
            flush();
            $abort = ignore_user_abort(0);
            sleep(20);
        }
        $waited++;
        if ($waited > 10) {
            # we have waited 10 cycles, abort and quit script
            output($GLOBALS['I18N']->get('We have been waiting too long, I guess the other process is still going ok'));
            exit;
        }
        $running_req = Sql_query("select now() - modified,id from " . $tables["sendprocess"] . " where page = \"{$thispage}\" and alive order by started desc");
        $running_res = Sql_Fetch_row($running_req);
    }
    $res = Sql_query('insert into ' . $tables["sendprocess"] . ' (started,page,alive,ipaddress) values(now(),"' . $thispage . '",1,"' . getenv("REMOTE_ADDR") . '")');
    $send_process_id = Sql_Insert_Id();
    $abort = ignore_user_abort(1);
    return $send_process_id;
}
开发者ID:TheReaCompany,项目名称:pooplog,代码行数:40,代码来源:lib.php

示例4: elseif

    if (!count($testlists)) {
        print '<script language="Javascript" type="text/javascript"> document.forms[0].output.value="Error: cannot find any test lists to use";</script>' . "\n";
    } elseif (!isset($eraseall)) {
        print '<script language="Javascript" type="text/javascript"> document.forms[0].output.value="Filling ";</script>' . "\n";
        for ($i = 0; $i <= 100; ++$i) {
            set_time_limit(60);
            flush();
            reset($testlists);
            while (list($key, $val) = each($testlists)) {
                if (!fill(getmypid() . $i, $val)) {
                    return;
                }
            }
        }
    } else {
        $req = Sql_Query("select id from {$tables['user']} where email like \"testuser%\"");
        $i = 1;
        set_time_limit(60);
        print '<script language="Javascript" type="text/javascript"> document.forms[0].output.value="Erasing ";</script>' . "\n";
        flush();
        while ($row = Sql_Fetch_row($req)) {
            Sql_Query("delete quick from {$tables['user_attribute']} where userid = {$row['0']}");
            Sql_Query("delete quick from {$tables['listuser']} where userid = {$row['0']}");
            Sql_Query("delete quick from {$tables['usermessage']} where userid = {$row['0']}");
            Sql_Query("delete quick from {$tables['user']} where id = {$row['0']}");
            ++$i;
        }
    }
} else {
    print Error('Cannot do stresstest in safe mode');
}
开发者ID:gillima,项目名称:phplist3,代码行数:31,代码来源:stresstest.php

示例5: getPageLock

function getPageLock($force = 0)
{
    global $tables;
    $thispage = $GLOBALS['page'];
    if ($thispage == 'pageaction') {
        $thispage = $_GET['action'];
    }
    $thispage = preg_replace('/\\W/', '', $thispage);
    #  cl_output('getting pagelock '.$thispage);
    #  ob_end_flush();
    if ($GLOBALS['commandline'] && $thispage == 'processqueue') {
        if (is_object($GLOBALS['MC'])) {
            ## multi-send requires a valid memcached setup
            $max = MAX_SENDPROCESSES;
        } else {
            $max = 1;
        }
    } else {
        $max = 1;
    }
    ## allow killing other processes
    if ($force) {
        Sql_query('delete from ' . $tables['sendprocess'] . ' where page = "' . sql_escape($thispage) . '"');
    }
    $running_req = Sql_query(sprintf('select now() - modified as age,id from %s where page = "%s" and alive order by started desc', $tables['sendprocess'], sql_escape($thispage)));
    $count = Sql_Num_Rows($running_req);
    $running_res = Sql_Fetch_Assoc($running_req);
    $waited = 0;
    # while ($running_res['age'] && $count >= $max) { # a process is already running
    while ($count >= $max) {
        # don't check age, as it may be 0
        #   cl_output('running process: '.$running_res['age'].' '.$max);
        if ($running_res['age'] > 600) {
            # some sql queries can take quite a while
            #cl_output($running_res['id'].' is old '.$running_res['age']);
            # process has been inactive for too long, kill it
            Sql_query("update {$tables['sendprocess']} set alive = 0 where id = " . $running_res['id']);
        } elseif ((int) $count >= (int) $max) {
            #   cl_output (sprintf($GLOBALS['I18N']->get('A process for this page is already running and it was still alive %s seconds ago'),$running_res['age']));
            output(s('A process for this page is already running and it was still alive %d seconds ago', $running_res['age']), 0);
            sleep(1);
            # to log the messages in the correct order
            if ($GLOBALS['commandline']) {
                cl_output(s('A process for this page is already running and it was still alive %d seconds ago', $running_res['age']), 0);
                cl_output($GLOBALS['I18N']->get('Running commandline, quitting. We\'ll find out what to do in the next run.'));
                exit;
            }
            output($GLOBALS['I18N']->get('Sleeping for 20 seconds, aborting will quit'), 0);
            flush();
            $abort = ignore_user_abort(0);
            sleep(20);
        }
        ++$waited;
        if ($waited > 10) {
            # we have waited 10 cycles, abort and quit script
            output($GLOBALS['I18N']->get('We have been waiting too long, I guess the other process is still going ok'), 0);
            return false;
        }
        $running_req = Sql_query('select now() - modified,id from ' . $tables['sendprocess'] . " where page = \"{$thispage}\" and alive order by started desc");
        $count = Sql_Num_Rows($running_req);
        $running_res = Sql_Fetch_row($running_req);
    }
    if (!empty($GLOBALS['commandline'])) {
        $processIdentifier = SENDPROCESS_SERVERNAME . ':' . getmypid();
    } else {
        $processIdentifier = $_SERVER['REMOTE_ADDR'];
    }
    $res = Sql_query('insert into ' . $tables['sendprocess'] . ' (started,page,alive,ipaddress) values(now(),"' . $thispage . '",1,"' . $processIdentifier . '")');
    $send_process_id = Sql_Insert_Id();
    $abort = ignore_user_abort(1);
    #  cl_output('Got pagelock '.$send_process_id );
    return $send_process_id;
}
开发者ID:pedru,项目名称:phplist3,代码行数:73,代码来源:lib.php

示例6: Sql_query

        $result = Sql_query($query);
    }
    echo "<br /><font color=red size=+2>" . $GLOBALS['I18N']->get("User added") . "</font><br />";
}
if (isset($_REQUEST["delete"])) {
    $delete = sprintf('%d', $_REQUEST["delete"]);
    # single delete the index in delete
    print $GLOBALS['I18N']->get("Deleting") . " {$delete} ..\n";
    $query = "delete from {$tables["listuser"]} where listid = {$id} and userid = {$delete}";
    $result = Sql_query($query);
    print "... " . $GLOBALS['I18N']->get("Done") . "<br />\n";
    Redirect("members&id={$id}");
}
if (isset($id)) {
    $result = Sql_query("SELECT count(*) FROM {$tables["listuser"]},{$tables["user"]}\n    where listid = {$id} and userid = {$tables["user"]}.id");
    $row = Sql_Fetch_row($result);
    $total = $row[0];
    print "{$total} " . $GLOBALS['I18N']->get("Users on this list") . "<p>";
    if ($total > MAX_USER_PP) {
        if (isset($start) && $start) {
            $listing = $GLOBALS['I18N']->get("Listing user") . " {$start} " . $GLOBALS['I18N']->get("to") . " " . ($start + MAX_USER_PP);
            $limit = "limit {$start}," . MAX_USER_PP;
        } else {
            $listing = $GLOBALS['I18N']->get("Listing user 1 to 50");
            $limit = "limit 0,50";
            $start = 0;
        }
        printf('<table border=1><tr><td colspan=4 align=center>%s</td></tr><tr><td>%s</td><td>%s</td><td>
          %s</td><td>%s</td></tr></table><p><hr>', $listing, PageLink2("members", "&lt;&lt;", "start=0&id={$id}"), PageLink2("members", "&lt;", sprintf('start=%d&id=%d', max(0, $start - MAX_USER_PP), $id)), PageLink2("members", "&gt;", sprintf('start=%d&id=%d', min($total, $start + MAX_USER_PP), $id)), PageLink2("members", "&gt;&gt;", sprintf('start=%d&id=%d', $total - MAX_USER_PP, $id)));
    }
    $result = Sql_query("SELECT {$tables['user']}.id,email,confirmed,rssfrequency FROM\n    {$tables["listuser"]},{$tables["user"]} where {$tables["listuser"]}.listid = {$id} and\n    {$tables["listuser"]}.userid = {$tables["user"]}.id order by confirmed desc,email {$limit}");
开发者ID:radicaldesigns,项目名称:amp,代码行数:31,代码来源:members.php

示例7: UserAttributeValue

function UserAttributeValue($user = 0, $attribute = 0)
{
    # workaround for integration webbler/phplist
    global $table_prefix, $tables;
    if (!isset($table_prefix)) {
        $table_prefix = "phplist_";
    }
    #  if (!$user || !$attribute) return;
    if (isset($tables["attribute"])) {
        $att_table = $tables["attribute"];
        $user_att_table = $tables["user_attribute"];
    } else {
        $att_table = "attribute";
        $user_att_table = "user_attribute";
    }
    $att = Sql_Fetch_array_Query("select * from {$att_table} where id = {$attribute}");
    switch ($att["type"]) {
        case "checkboxgroup":
            $val_ids = Sql_Fetch_Row_Query("select value from {$user_att_table} where userid = {$user} and attributeid = {$attribute}");
            if ($val_ids[0]) {
                $value = '';
                $res = Sql_Query("select {$table_prefix}" . "listattr_" . $att["tablename"] . ".name\n          from {$user_att_table},{$table_prefix}" . "listattr_" . $att["tablename"] . "\n          where {$user_att_table}" . ".userid = " . $user . " and\n          {$table_prefix}" . "listattr_" . $att["tablename"] . ".id in ({$val_ids['0']}) and\n          {$user_att_table}" . ".attributeid = " . $attribute);
                while ($row = Sql_Fetch_row($res)) {
                    $value .= $row[0] . "; ";
                }
                $value = substr($value, 0, -2);
            } else {
                $value = "";
            }
            break;
        case "select":
        case "radio":
            $res = Sql_Query("select {$table_prefix}" . "listattr_" . $att["tablename"] . ".name\n        from {$user_att_table},{$table_prefix}" . "listattr_" . $att["tablename"] . "\n        where {$user_att_table}" . ".userid = " . $user . " and\n        {$table_prefix}" . "listattr_" . $att["tablename"] . ".id = {$user_att_table}" . ".value and\n        {$user_att_table}" . ".attributeid = " . $attribute);
            $row = Sql_Fetch_row($res);
            $value = $row[0];
            break;
        default:
            $res = Sql_Query("select value from {$user_att_table} where\n        {$user_att_table}" . ".userid = " . $user . " and attributeid =\n        " . $attribute);
            $row = Sql_Fetch_row($res);
            $value = $row[0];
    }
    return $value;
}
开发者ID:kvervo,项目名称:phplist-aiesec,代码行数:43,代码来源:userlib.php

示例8: getPageLock

function getPageLock() {
	global $tables;
	$thispage = $GLOBALS["page"];
  $running_req = Sql_query("select now() - modified,id from ".$tables["sendprocess"]." where page = \"$thispage\" and alive order by started desc");
  $running_res = Sql_Fetch_row($running_req);
	$waited = 0;
  while ($running_res[1]) { # a process is already running
    output ("A process for this page is already running and it was still alive $running_res[0] seconds ago");
    output ("Sleeping for 20 seconds, aborting will now quit");
    $abort = ignore_user_abort(0);
    sleep(20);
		$waited++;
		if ($waited > 10) {
			# we have waited 10 cycles, abort and quit script
			output("We've been waiting too long, I guess the other script is still going ok");
			exit;
		}
    $running_req = Sql_query("select now() - modified,id from ".$tables["sendprocess"]." where page = \"$thispage\" and alive order by started desc");
    $running_res = Sql_Fetch_row($running_req);
    if ($running_res[0] > 1200) # some sql queries can take quite a while
      # process has been inactive for too long, kill it
      Sql_query("update {$tables["sendprocess"]} set alive = 0 where id = $running_res[1]");
  }
  $res = Sql_query('insert into '.$tables["sendprocess"].' (started,page,alive,ipaddress) values(now(),"'.$thispage.'",1,"'.getenv("REMOTE_ADDR").'")');
  $send_process_id = Sql_Insert_Id();
  $abort = ignore_user_abort(1);
  return $send_process_id;
}
开发者ID:radicaldesigns,项目名称:amp,代码行数:28,代码来源:lib.php


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