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


PHP Sql_Affected_Rows函数代码示例

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


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

示例1: saveConfig

 function saveConfig($key, $val, $editable = 1)
 {
     Sql_Query(sprintf('update %s set value = "%s",editable = %d where item = "%s"', $this->tables["config"], $val, $editable, $key));
     if (!Sql_Affected_Rows()) {
         Sql_Query(sprintf('insert into %s (item,value,editable)   values("%s","%s",%d)', $this->tables["config"], $key, $val, $editable));
     }
 }
开发者ID:ber5ien,项目名称:www.jade-palace.co.uk,代码行数:7,代码来源:phplist.php

示例2: rssUserHasContent

function rssUserHasContent($userid,$messageid,$frequency) {
	global $tables;
  switch ($frequency) {
    case "weekly":
      $interval = 'interval 7 day';break;
    case "monthly":
      $interval = 'interval 1 month';break;
    case "daily":
    default:
      $interval = 'interval 1 day';break;
  }
  
	$cansend_req = Sql_Query(sprintf('select date_add(last,%s) < now() from %s where userid = %d',
      $interval,$tables["user_rss"],$userid));
	$exists = Sql_Affected_Rows();
	$cansend = Sql_Fetch_Row($cansend_req);
  if (!$exists || $cansend[0]) {
  	# we can send this user as far as the frequency is concerned
    # now check whether there is actually some content

    # check what lists to use. This is the intersection of the lists for the
    # user and the lists for the message
    $lists = array();
    $listsreq = Sql_Query(sprintf('
    	select %s.listid from %s,%s where %s.listid = %s.listid and %s.userid = %d and
      %s.messageid = %d',
      $tables["listuser"],$tables["listuser"],$tables["listmessage"],
			$tables["listuser"],$tables["listmessage"],
      $tables["listuser"],$userid,$tables["listmessage"],$messageid));
   	while ($row = Sql_Fetch_Row($listsreq)) {
    	array_push($lists,$row[0]);
    }
    if (!sizeof($lists))
    	return 0;
    $liststosend = join(",",$lists);
    # request the rss items that match these lists and that have not been sent to this user
    $itemstosend = array();
		$max = sprintf('%d',getConfig("rssmax"));
		if (!$max) {
			$max = 30;
		}

    $itemreq = Sql_Query("select {$tables["rssitem"]}.*
	    from {$tables["rssitem"]} where {$tables["rssitem"]}.list in ($liststosend) order by added desc, list,title limit $max");
    while ($item = Sql_Fetch_Array($itemreq)) {
    	Sql_Query("select * from {$tables["rssitem_user"]} where itemid = {$item["id"]} and userid = $userid");
      if (!Sql_Affected_Rows()) {
				array_push($itemstosend,$item["id"]);
      }
    }
  #  print "<br/>Items to send for user $userid: ".sizeof($itemstosend);
    # if it is less than the treshold return nothing
    $treshold = getConfig("rsstheshold");
    if (sizeof($itemstosend) >= $treshold)
     	return $itemstosend;
    else
      return array();
  }
 	return array();
}
开发者ID:radicaldesigns,项目名称:amp,代码行数:60,代码来源:rsslib.php

示例3: getPassword

 public function getPassword($email)
 {
     $email = preg_replace("/[;,\"\\']/", '', $email);
     $req = Sql_Query('select email,password,loginname from ' . $GLOBALS['tables']['admin'] . ' where email = "' . sql_escape($email) . '"');
     if (Sql_Affected_Rows()) {
         $row = Sql_Fetch_Row($req);
         return $row[1];
     }
 }
开发者ID:gillima,项目名称:phplist3,代码行数:9,代码来源:phpListAdminAuthentication.php

示例4: mysql_session_read

function mysql_session_read($SessionID)
{
    #	dbg("Reading session info for $SessionID");
    $SessionTableName = $GLOBALS["SessionTableName"];
    $SessionID = addslashes($SessionID);
    $session_data_req = sql_query("SELECT data FROM {$SessionTableName} WHERE sessionid = '{$SessionID}'");
    if (Sql_Affected_Rows() == 1) {
        $data = Sql_Fetch_Row($session_data_req);
        return $data[0];
    } else {
        return false;
    }
}
开发者ID:dehvCurtis,项目名称:phplist,代码行数:13,代码来源:sessionlib.php

示例5: accessLevel

function accessLevel($page)
{
    global $tables, $access_levels;
    if (!$GLOBALS["require_login"] || isSuperUser()) {
        return "all";
    }
    if (!isset($_SESSION["adminloggedin"])) {
        return 0;
    }
    if (!is_array($_SESSION["logindetails"])) {
        return 0;
    }
    # check whether it is a page to protect
    Sql_Query("select id from {$tables["task"]} where page = \"{$page}\"");
    if (!Sql_Affected_Rows()) {
        return "all";
    }
    $req = Sql_Query(sprintf('select level from %s,%s where adminid = %d and page = "%s" and %s.taskid = %s.id', $tables["task"], $tables["admin_task"], $_SESSION["logindetails"]["id"], $page, $tables["admin_task"], $tables["task"]));
    $row = Sql_Fetch_Row($req);
    return $access_levels[$row[0]];
}
开发者ID:alancohen,项目名称:alancohenexperience-com,代码行数:21,代码来源:accesscheck.php

示例6: Sql_query

<p>На этой странице Вы можете подготовить письмо для дальнейшей отправки. Можно указать всю необходимую информацию, исключая списки рассылки для отправки. Затем, в момент отправки подготовленного письма, можно будет выбрать списки рассылки и письмо будет отправлено. </p>

<p>Ваше подготовленное письмо постоянно, то есть оно не исчезнет после отправки и может быть использовано много раз повторно. Будьте осторожны, пользуясь этой возможностью, потому что это может привести к тому, что Вы будете отправлять одни и те же письма Вашим подписчикам несколько раз.</p>

<p> Эта функциональность специально реализована с целью использовать при совместной работе в системе нескольких администраторов. Если главный администратор готовит такое письмо, простые администраторы могут отправлять его по своим спискам рассылки. В этом случае, Вы можете использовать дополнительные метки в письме: атрибуты администратора.</p>

<p>Для примера, если у Вас есть атрибут администратора <b>Name</b> (Имя), Вы можете добавить метку [LISTOWNER.NAME], она будет заменена на <b>Имя</b> владельца списка, кому производится отправка этого письма. Значение будет установлено вне зависимости от того, кто отправляет письмо. Таким образом, если главный администратор отправляет письмо по списку, которые принадлежит кому-то ещё, метка [LISTOWNER] будет заменена на значение владельца списка, а не значения главного администратора.</p>

<p>Для справки:<br/>
Метка [LISTOWNER] задаётся в формате <b>[LISTOWNER.АТРИБУТ]</b></p>

<p>На текущий момент заданы следующие атрибуты администратора:
<table border=1><tr><td><b>Атрибут</b></td><td><b>Метка</b></td></tr>
<?php 
$req = Sql_query("select name from {$tables['adminattribute']} order by listorder");
if (!Sql_Affected_Rows()) {
    print '<tr><td colspan=2>Атрибутов администратора нет</td></tr>';
}
while ($row = Sql_Fetch_Row($req)) {
    if (strlen($row[0]) < 20) {
        printf('<tr><td>%s</td><td>[LISTOWNER.%s]</td></tr>', $row[0], strtoupper($row[0]));
    }
}
?>
</p>
开发者ID:jbeigh,项目名称:phplist-lan-help,代码行数:25,代码来源:preparemessage.php

示例7: getNewAttributeTablename

function getNewAttributeTablename($name) {
  $lc_name = substr(preg_replace("/\W/","", strtolower($name)),0,10);
#  if ($lc_name == "") Fatal_Error("Name cannot be empty: $lc_name");
	if (!$lc_name) $lc_name = "attribute";
  Sql_Query("select * from attribute where tablename = \"$lc_name\"");
#  if (Sql_Affected_Rows()) Fatal_Error("Name is not unique enough");
	$c = 1;
  $basename = $lc_name;
  while (Sql_Affected_Rows() && $c < 100) {
  	$lc_name = $basename.$c;
  	Sql_Query("select * from attribute where tablename = \"$lc_name\"");
    $c++;
  }
	return $lc_name;
}
开发者ID:radicaldesigns,项目名称:amp,代码行数:15,代码来源:userlib.php

示例8: Sql_query

             if ($usetwo) {
                 Sql_query(sprintf('replace into %s (attributeid,userid,value) values(%d,%d,"%s")', $tables["user_attribute"], $firstname_att_id, $userid, $importuser["firstname"]));
                 Sql_query(sprintf('replace into %s (attributeid,userid,value) values(%d,%d,"%s")', $tables["user_attribute"], $lastname_att_id, $userid, $importuser["lastname"]));
             } else {
                 Sql_query(sprintf('replace into %s (attributeid,userid,value) values(%d,%d,"%s")', $tables["user_attribute"], $name_att_id, $userid, $importuser["personal"]));
             }
         }
         #add this user to the lists identified
         reset($lists);
         $addition = 0;
         $listoflists = "";
         while (list($key, $listid) = each($lists)) {
             $query = "replace INTO " . $tables["listuser"] . " (userid,listid,entered) values({$userid},{$listid},current_timestamp)";
             $result = Sql_query($query);
             # if the affected rows is 2, the user was already subscribed
             $addition = $addition || Sql_Affected_Rows() == 1;
             $listoflists .= "  * " . $available_lists[$listid] . "\n";
         }
         if ($addition) {
             $additional_emails++;
         }
         if (!TEST && $_POST["notify"] == "yes" && $addition) {
             $subscribemessage = str_replace('[LISTS]', $listoflists, getUserConfig("subscribemessage", $userid));
             sendMail($email, getConfig("subscribesubject"), $subscribemessage, system_messageheaders(), $envelope);
         }
     }
     // end if
 }
 // end foreach
 $num_lists = sizeof($lists);
 # be grammatically correct :-)
开发者ID:dehvCurtis,项目名称:phplist,代码行数:31,代码来源:import3.php

示例9: switch

    switch ($_GET['action']) {
        case 'suspall':
            $action_result .= $GLOBALS['I18N']->get('Suspending all') . ' ..';
            $result = Sql_query(sprintf('update %s set status = "suspended" where (status = "inprocess" or status = "submitted") %s', $tables['message'], $ownerselect_and));
            $suc6 = Sql_Affected_Rows();
            if ($suc6) {
                $action_result .= "... {$suc6} " . $GLOBALS['I18N']->get('Done');
            } else {
                $action_result .= '... ' . $GLOBALS['I18N']->get('Failed');
            }
            $action_result .= '<br /><hr /><br />';
            break;
        case 'markallsent':
            $action_result .= $GLOBALS['I18N']->get('Marking all as sent ') . '  ..';
            $result = Sql_query(sprintf('update %s set status = "sent", repeatinterval = 0,requeueinterval = 0 where (status = "suspended") %s', $tables['message'], $markSent, $ownerselect_and));
            $suc6 = Sql_Affected_Rows();
            if ($suc6) {
                $action_result .= "... {$suc6} " . $GLOBALS['I18N']->get('Done');
            } else {
                $action_result .= '... ' . $GLOBALS['I18N']->get('Failed');
            }
            $action_result .= '<br /><hr /><br />';
            break;
    }
}
if (!empty($action_result)) {
    #print ActionResult($action_result);
    $_SESSION['action_result'] = $action_result;
    Redirect('messages');
    exit;
}
开发者ID:gillima,项目名称:phplist3,代码行数:31,代码来源:messages.php

示例10: Sql_query

            break;
        default:
            $column = 'user.modified';
            break;
    }
}
##$subselect .= ' limit 500'; // just to test the progress meter
if ($list) {
    $result = Sql_query(sprintf('select * from
    %s where user.id = listuser.userid and listuser.listid = %d and %s >= "%s 00:00:00" and %s  <= "%s 23:59:59" %s
    ', $querytables, $list, $column, $fromdate, $column, $todate, $subselect));
} else {
    $result = Sql_query(sprintf('
    select * from %s where %s >= "%s 00:00:00" and %s  <= "%s 23:59:59" %s', $querytables, $column, $fromdate, $column, $todate, $subselect));
}
$todo = Sql_Affected_Rows();
$done = 0;
fwrite($exportfile, $GLOBALS['I18N']->get('List Membership') . $row_delim);
while ($user = Sql_fetch_array($result)) {
    ## re-verify the blacklist status
    if (empty($user['blacklisted']) && isBlackListed($user['email'])) {
        $user['blacklisted'] = 1;
        Sql_Query(sprintf('update %s set blacklisted = 1 where email = "%s"', $GLOBALS['tables']['user'], $user['email']));
    }
    set_time_limit(500);
    if ($done % 50 == 0) {
        print '<script type="text/javascript">
    var parentJQuery = window.parent.jQuery;
    parentJQuery("#progressbar").updateProgress("' . $done . ',' . $todo . '");
    </script>';
        flush();
开发者ID:gillima,项目名称:phplist3,代码行数:31,代码来源:export.php

示例11: Sql_query

    print $tabs->display();
}
$countquery = ' select *' . ' from ' . $tables['list'] . $subselect;
$countresult = Sql_query($countquery);
$total = Sql_Num_Rows($countresult);
if ($total == 0 && sizeof($aListCategories) && $current == '' && empty($_GET['tab'])) {
    ## reload to first category, if none found by default (ie all lists are categorised)
    if (!empty($aListCategories[0])) {
        Redirect('list&tab=' . $aListCategories[0]);
    }
}
print '<p class="total">' . $total . ' ' . $GLOBALS['I18N']->get('Lists') . '</p>';
$limit = '';
$query = ' select *' . ' from ' . $tables['list'] . $subselect . ' order by listorder ' . $limit;
$result = Sql_query($query);
$numlists = Sql_Affected_Rows($result);
$ls = new WebblerListing(s('Lists'));
if ($numlists > 15) {
    Info(s('You seem to have quite a lot of lists, do you want to organise them in categories? ') . ' ' . PageLinkButton('catlists', $GLOBALS['I18N']->get('Great idea!')));
    /* @@TODO add paging when there are loads of lists, because otherwise the page is very slow
      $limit = ' limit 50';
      $query
      = ' select *'
      . ' from ' . $tables['list']
      . $subselect
      . ' order by listorder '.$limit;
      $result = Sql_query($query);
      */
}
while ($row = Sql_fetch_array($result)) {
    ## we only consider confirmed and not blacklisted subscribers members of a list
开发者ID:juvenal,项目名称:PHPlist,代码行数:31,代码来源:list.php

示例12: Sql_Affected_Rows

     print Sql_Affected_Rows() . " " . $GLOBALS['I18N']->get('entries apply') . "<br/>";
     while ($row = Sql_Fetch_Row($req)) {
         Sql_Query("delete from {$tables["user_attribute"]} where userid = {$row['0']}");
     }
     $req = Sql_Verbose_Query("select {$tables["listuser"]}.userid\n          from {$tables["listuser"]} left join {$tables["user"]} on {$tables["listuser"]}.userid = {$tables["user"]}.id\n          where {$tables["user"]}.id IS NULL group by {$tables["listuser"]}.userid");
     print Sql_Affected_Rows() . " " . $GLOBALS['I18N']->get('entries apply') . "<br/>";
     while ($row = Sql_Fetch_Row($req)) {
         Sql_Query("delete from {$tables["listuser"]} where userid = {$row['0']}");
     }
     $req = Sql_Verbose_Query("select {$tables["usermessage"]}.userid\n          from {$tables["usermessage"]} left join {$tables["user"]} on {$tables["usermessage"]}.userid = {$tables["user"]}.id\n          where {$tables["user"]}.id IS NULL group by {$tables["usermessage"]}.userid");
     print Sql_Affected_Rows() . " " . $GLOBALS['I18N']->get('entries apply') . "<br/>";
     while ($row = Sql_Fetch_Row($req)) {
         Sql_Query("delete from {$tables["usermessage"]} where userid = {$row['0']}");
     }
     $req = Sql_Verbose_Query("select {$tables["user_message_bounce"]}.user\n          from {$tables["user_message_bounce"]} left join {$tables["user"]} on {$tables["user_message_bounce"]}.user = {$tables["user"]}.id\n          where {$tables["user"]}.id IS NULL group by {$tables["user_message_bounce"]}.user");
     print Sql_Affected_Rows() . " " . $GLOBALS['I18N']->get('entries apply') . "<br/>";
     while ($row = Sql_Fetch_Row($req)) {
         Sql_Query("delete from {$tables["user_message_bounce"]} where user = {$row['0']}");
     }
 }
 $table_list = $tables["user"] . $findtables;
 if ($find) {
     $listquery = "select {$tables["user"]}.id,{$findfield},{$tables["user"]}.confirmed from " . $table_list . " where {$findbyselect}";
     $count = Sql_query("SELECT count(*) FROM " . $table_list . " where {$findbyselect}");
     $unconfirmedcount = Sql_query("SELECT count(*) FROM " . $table_list . " where !confirmed && {$findbyselect}");
     if ($_GET["unconfirmed"]) {
         $listquery .= ' and !confirmed';
     }
 } else {
     $listquery = "select {$tables["user"]}.id,{$findfield},{$tables["user"]}.confirmed from " . $table_list;
     $count = Sql_query("SELECT count(*) FROM " . $table_list);
开发者ID:juvenal,项目名称:PHPlist,代码行数:31,代码来源:reconcileusers.php

示例13: ListAvailableLists

function ListAvailableLists($userid = 0, $lists_to_show = "")
{
    global $tables;
    if (isset($_POST['list'])) {
        $list = $_POST["list"];
    } else {
        $list = '';
    }
    $subselect = "";
    $listset = array();
    $subscribed = array();
    $showlists = explode(",", $lists_to_show);
    if (PREFERENCEPAGE_SHOW_PRIVATE_LISTS && !empty($userid)) {
        ## merge with the subscribed lists, regardless of public state
        $req = Sql_Query(sprintf('select listid from %s where userid = %d', $tables['listuser'], $userid));
        while ($row = Sql_Fetch_Row($req)) {
            $subscribed[] = $row[0];
        }
        $showlists = array_unique(array_merge($showlists, $subscribed));
    }
    foreach ($showlists as $listid) {
        if (preg_match("/^\\d+\$/", $listid)) {
            array_push($listset, $listid);
        }
    }
    if (sizeof($listset) >= 1) {
        $subselect = "where id in (" . join(",", $listset) . ") ";
    }
    $some = 0;
    $html = '<ul class="list">';
    $result = Sql_query("SELECT * FROM {$GLOBALS["tables"]["list"]} {$subselect} order by listorder, name");
    while ($row = Sql_fetch_array($result)) {
        if ($row["active"] || in_array($row['id'], $subscribed)) {
            $html .= '<li class="list"><input type="checkbox" name="list[' . $row["id"] . ']" value="signup" ';
            if (isset($list[$row["id"]]) && $list[$row['id']] == "signup") {
                $html .= 'checked="checked"';
            }
            if ($userid) {
                $req = Sql_Fetch_Row_Query(sprintf('select userid from %s where userid = %d and listid = %d', $GLOBALS["tables"]["listuser"], $userid, $row["id"]));
                if (Sql_Affected_Rows()) {
                    $html .= 'checked="checked"';
                }
            }
            $html .= " /><b>" . stripslashes($row["name"]) . '</b><div class="listdescription">';
            $desc = nl2br(stripslashes($row["description"]));
            #     $html .= '<input type="hidden" name="listname['.$row["id"] . ']" value="'.htmlspecialchars(stripslashes($row["name"])).'"/>';
            $html .= $desc . '</div></li>';
            $some++;
            if ($some == 1) {
                $singlelisthtml = sprintf('<input type="hidden" name="list[%d]" value="signup" />', $row["id"]);
                $singlelisthtml .= '<input type="hidden" name="listname[' . $row["id"] . ']" value="' . htmlspecialchars(stripslashes($row["name"])) . '"/>';
            }
        }
    }
    $html .= '</ul>';
    $hidesinglelist = getConfig("hide_single_list");
    if (!$some) {
        global $strNotAvailable;
        return '<p class="information">' . $strNotAvailable . '</p>';
    } elseif ($some == 1 && ($hidesinglelist == "true" || $hidesinglelist === true || $hidesinglelist === "1")) {
        return $singlelisthtml;
    } else {
        global $strPleaseSelect;
        return '<p class="information">' . $strPleaseSelect . ':</p>' . $html;
    }
}
开发者ID:dehvCurtis,项目名称:phplist,代码行数:66,代码来源:subscribelib2.php

示例14: array_push

             } else {
                 $groups = $_SESSION["groups"];
             }
             if (isset($everyone_groupid) && !in_array($everyone_groupid, $groups)) {
                 array_push($groups, $everyone_groupid);
             }
             if (defined('IN_WEBBLER') && is_array($groups)) {
                 #add this user to the groups identified
                 reset($groups);
                 $groupaddition = 0;
                 while (list($key, $groupid) = each($groups)) {
                     if ($groupid) {
                         $query = sprintf('replace INTO user_group (userid,groupid,type) values(%d,%d,%d)', $userid, $groupid, $_SESSION['grouptype']);
                         $result = Sql_query($query);
                         # if the affected rows is 2, the user was already subscribed
                         $groupaddition = $groupaddition || Sql_Affected_Rows() == 1;
                     }
                 }
                 if ($groupaddition) {
                     $count["group_add"]++;
                 }
             }
         }
     }
     // end else not test
     if ($_SESSION["test_import"] && $c > 50) {
         break;
     }
 }
 $report = "";
 if (empty($some) && !$count["list_add"]) {
开发者ID:Gerberus,项目名称:phplist3,代码行数:31,代码来源:import2.php

示例15: image_exists

 function image_exists($templateid, $filename)
 {
     $req = Sql_Query(sprintf('select * from %s where template = %d and (filename = "%s" or filename = "%s")', $GLOBALS["tables"]["templateimage"], $templateid, $filename, basename($filename)));
     return Sql_Affected_Rows();
 }
开发者ID:alancohen,项目名称:alancohenexperience-com,代码行数:5,代码来源:class.phplistmailer.php


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