GetSQLData($SqlStr); $Info = $sql->GetResult(); $SqlStr = " select * from counter"; $SqlStr .= " where id = 1"; $sql->GoQuery($SqlStr); $sql->GetSQLData($SqlStr); $Counter = $sql->GetResult(); $sql->SetSQLValue("ch", $Counter[0]['ch']+1); $sql->SetFastInsert(0); $sql->SetQuery("UPDATE", "counter", "where id=1"); $sql->GoQuery($sql->GetSQLSyntax()); $Smarty->assign("Info", $Info); $Smarty->assign("Counter", $Counter); $Smarty->register_function("CSubStr", "Chinese_Sub_Str"); function Chinese_Sub_Str($params) { $value = $params['value']; $len = $params['len']; if (strlen($value) <= $len ) { return $value; } else { $I = 0; while ($I < $len) { $strTMP = substr($value,$I,1); if ( ord($strTMP) > 127 ) { $strTMP = substr($value,$I,2); $I = $I + 2; $len = $len + 1; } else { $I = $I + 1; } $strLast[] = $strTMP; } $strLast = implode("",$strLast)."..."; return $strLast; } } ////////////////// $Smarty->display("index.htm"); ?>