本文整理匯總了PHP中DedeSql::GetTotalRow方法的典型用法代碼示例。如果您正苦於以下問題:PHP DedeSql::GetTotalRow方法的具體用法?PHP DedeSql::GetTotalRow怎麽用?PHP DedeSql::GetTotalRow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DedeSql
的用法示例。
在下文中一共展示了DedeSql::GetTotalRow方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ShowMsg
if(empty($dopost)) $dopost="";
if($dopost=="add")
{
if(ereg("[^0-9a-zA-Z_@!\.-]",$pwd)){
ShowMsg("用戶密碼不合法!","-1",0,300);
exit();
}
if(ereg("[^0-9a-zA-Z_@!\.-]",$userid)){
ShowMsg("用戶名不合法!","-1",0,300);
exit();
}
$dsql = new DedeSql(false);
$dsql->SetQuery("Select * from `#@__admin` where userid='$userid' Or uname='$uname'");
$dsql->Execute();
$ns = $dsql->GetTotalRow();
if($ns>0){
$dsql->Close();
ShowMsg("用戶名或筆名已存在,不允許重複使用!","-1");
exit();
}
$ks = Array();
foreach($typeid as $v){
$vs = explode('-',$v);
if(isset($vs[1])) $t = $vs[1];
else $t = $vs[0];
if(!isset($ks[$vs[0]])) $ks[$t] = 1;
}
$typeid = '';
foreach($ks as $k=>$v){
if($k>0) $typeid .=($typeid=='' ? $k : ','.$k);
示例2: ShowMsg
$dsql->Close();
ShowMsg("新增變量失敗,可能有非法字符!","sys_info.php?gp=$vargroup");
exit();
}
$configfile = dirname(__FILE__)."/../include/config_hand.php";
$configfile_bak = dirname(__FILE__)."/../include/config_hand_bak.php";
if(!is_writeable($configfile)){
$dsql->Close();
ShowMsg("成功保存變量,但由於 $configfile 無法寫入,因此不能更新配置文件!","sys_info.php?gp=$vargroup");
exit();
}else{
$dsql->SetQuery("Select varname,value From #@__sysconfig order by aid asc");
$dsql->Execute();
if($dsql->GetTotalRow()<=0){
$dsql->Close();
ShowMsg("成功保存變量但從數據庫讀取所有數據時失敗,無法更新配置文件!","sys_info.php?gp=$vargroup");
exit();
}
copy($configfile,$configfile_bak);
$fp = fopen($configfile,"w");
fwrite($fp,"<"."?php\r\n");
while($row = $dsql->GetArray()){
fwrite($fp,"\${$row['varname']} = '".str_replace("'","\\'",$row['value'])."';\r\n");
}
fwrite($fp,"?".">");
fclose($fp);
$dsql->Close();
ShowMsg("成功保存變量並更新配置文件!","sys_info.php?gp=$vargroup");
exit();
示例3: if
}else if($dopost=="query") //執行SQL語句
{
$t1 = ExecTime();
$sqlquery = trim(stripslashes($sqlquery));
if(eregi("drop(.*)table",$sqlquery)
|| eregi("drop(.*)database",$sqlquery)){
echo "<span style='font-size:10pt'>刪除'數據表'或'數據庫'的語句不允許在這裏執行。</span>";
$dsql->Close();
exit();
}
//運行查詢語句
if(eregi("^select ",$sqlquery))
{
$dsql->SetQuery($sqlquery);
$dsql->Execute();
if($dsql->GetTotalRow()<=0) echo "運行SQL:{$sqlquery},無返回記錄!";
else echo "運行SQL:{$sqlquery},共有".$dsql->GetTotalRow()."條記錄,最大返回100條!";
$j = 0;
while($row = $dsql->GetArray())
{
$j++;
if($j>100) break;
echo "<hr size=1 width='100%'/>";
echo "記錄:$j";
echo "<hr size=1 width='100%'/>";
foreach($row as $k=>$v){
if(ereg("[^0-9]",$k)){ echo "<font color='red'>{$k}:</font>{$v}<br/>\r\n"; }
}
}
$t2 = ExecTime();
echo "<hr>執行時間:".($t2-$t1);
示例4: foreach
foreach ($_POST as $k => $v) {
if (ereg("^edit___", $k)) {
$v = ${$k};
} else {
continue;
}
$k = ereg_replace("^edit___", "", $k);
if (strlen($v) > 250) {
showmsg("{$k} 太長,不能超過250字節", '-1');
exit;
}
$savesql->ExecuteNoneQuery("Update #@__config set `config_value`='{$v}' where `config_name`='{$k}' ");
}
$savesql->SetQuery("Select `config_name`,`config_value` From `#@__config` order by `id` asc");
$savesql->Execute();
if ($savesql->GetTotalRow() <= 0) {
$savesql->Close();
ShowMsg("成功保存變量但從數據庫讀取所有數據時失敗,無法更新配置文件!", "javascript:;");
exit;
}
@copy($configfile, $configfile_bak);
$fp = @fopen($configfile, 'w');
@flock($fp, 3);
@fwrite($fp, "<" . "?php\r\n") or die("配置文件'{$configfile}'不支持寫入,本次操作無效!<a href='system_basic.php'>返回</a>");
while ($row = $savesql->GetArray()) {
$row['value'] = str_replace("'", "\\'", $row['config_value']);
fwrite($fp, "\${$row['config_name']} = '" . $row['config_value'] . "';\r\n");
}
fwrite($fp, "?>");
fclose($fp);
$message = "成功修改了係統配置文件config_base.php";
示例5: ShowMsg
else $condition = "";
$rs = $dsql->ExecuteNoneQuery("Update $exptable set $rpfield=Replace($rpfield,'$rpstring','$tostring') $condition ");
$dsql->executenonequery("OPTIMIZE TABLE `$exptable`");
$dsql->Close();
if($rs) ShowMsg("成功完成數據替換!","javascript:;");
else ShowMsg("數據替換失敗!","javascript:;");
}else
{
if(!empty($condition)) $condition = " And $condition ";
else $condition = "";
$rpstring = stripslashes($rpstring);
$rpstring2 = str_replace("\\","\\\\",$rpstring);
$rpstring2 = str_replace("'","\\'",$rpstring2);
$dsql->SetQuery("Select $keyfield,$rpfield From $exptable where $rpfield REGEXP '$rpstring2' $condition ");
$dsql->Execute();
$tt = $dsql->GetTotalRow();
if($tt==0){
$dsql->Close();
ShowMsg("根據你指定的正則,找不到任何東西!","javascript:;");
exit();
}
$oo = 0;
while($row = $dsql->GetArray()){
$kid = $row[$keyfield];
$rpf = eregi_replace($rpstring,$tostring,$row[$rpfield]);
$rs = $dsql->ExecuteNoneQuery("Update $exptable set $rpfield='$rpf' where $keyfield='$kid' ");
if($rs) $oo++;
}
$dsql->executenonequery("OPTIMIZE TABLE `$exptable`");
$dsql->close;
ShowMsg("共找到 $tt 條記錄,成功替換了 $oo 條!","javascript:;");
示例6: split
}
$titless = split('`',$titles);
if($deltype=='delnew') $orderby = " order by ID desc ";
else $orderby = " order by ID asc ";
$totalarc = 0;
foreach($titless as $title){
$title = trim($title);
if($title=='') $q1 = "Select ID,title From $maintable where channel='$channelid' and title='' $orderby ";
else{
$title = addslashes(urldecode($title));
$q1 = "Select ID,title From $maintable where channel='$channelid' and title='$title' $orderby ";
}
$dsql->SetQuery($q1);
$dsql->Execute();
$rownum = $dsql->GetTotalRow();
if($rownum<2) continue;
$i = 1;
while($row = $dsql->GetObject()){
$i++;
$naid = $row->ID;
$ntitle = $row->title;
if($i > $rownum){ continue; }
$totalarc++;
DelArc($naid);
}
}
$dsql->executenonequery("OPTIMIZE TABLE `$maintable`");
$dsql->Close();
ShowMsg("一共刪除了[{$totalarc}]篇重複的文檔!","javascript:;");
exit();