登錄 登錄 注冊 立即注冊 忘記密碼 找回密碼 購買邀請碼 misc.php?mod=buyinvitecode JS跳轉 onclick="window.location.href='home.php?mod=mobile&do=friend';" JS更換class的名稱 document.getElementById('idname').className='a'; document.getElementById('idname').style.display='block'; document.getElementById("idname").style.marginTop="30px"; 批量替換超鏈接:href="[^"]*" 過濾DZ代碼: preg_replace ("/\[[a-z][^\]]*\]|\[\/[a-z]+\]/i",'',preg_replace("/\[attach\]\d+\[\/attach\]/i",'',$message)); ……………………………………………………………………………………………………………………………………………………………… 調用單個數據 $qishi = DB::result(DB::query("SELECT qi FROM ".DB::table('jiangchi')." WHERE id = '1'")); 調用統計數據 $qishi = DB::result(DB::query("SELECT count(*) FROM ".DB::table('jiangchi')." WHERE id = '1'")); 單數據表調用 $perpage = 20; $curpage = empty ( $_GET['page'] ) ? 1 : intval ( $_GET['page'] ); $start = ($curpage-1)*$perpage; $askcount = DB::result(DB::query("SELECT COUNT(*) FROM ".DB::table('forum_thread')." WHERE fid = '2' AND authorid > 1 AND FROM_UNIXTIME(dateline, '%Y%m%d') = '$jintian'")); //$asklist $asklist = array(); if ($askcount) { $query = DB::query("SELECT * FROM ".DB::table('forum_thread')." WHERE fid = '2' AND displayorder > -1 ORDER BY tid ASC LIMIT $start,$perpage"); while ($value = DB::fetch($query)) { $asklist[] = $value; } } $multi = multi($askcount, $perpage, $curpage, "portal.php?mod=topic&topic=ask"); 多數據表調用 $perpage = 40; $curpage = empty ( $_GET['page'] ) ? 1 : intval ( $_GET['page'] ); $start = ($curpage-1)*$perpage; $acount = DB::result(DB::query("SELECT count(*) FROM ".DB::table('forum_forum')." b LEFT JOIN ".DB::table('forum_forumfield')." bf ON bf.fid=b.fid WHERE b.type='sub' AND b.status = 3 AND bf.icon != ''")); //$alist $alist = array(); if ($acount) { $query = DB::query("SELECT bf.*, b.* FROM ".DB::table('forum_forum')." b LEFT JOIN ".DB::table('forum_forumfield')." bf ON bf.fid=b.fid WHERE b.type='sub' AND b.status = 3 AND bf.icon != '' ORDER BY bf.shoplevel DESC, b.commoncredits DESC, bf.fid DESC LIMIT $start,$perpage"); while ($value = DB::fetch($query)) { $alist[] = $value; } } $multi = multi($acount, $perpage, $curpage, "這里填寫跳轉地址"); 前臺數據顯示 $value[authorid] 取數據表中符合條件的第一條數據 $app=array(); $app=DB::fetch_first("select * from ".DB::table('home_diy_center')." where id='{$id}'"); 人性化時間戳 截取字符字數 過濾DISCUZ代碼 preg_replace ("/\[[a-z][^\]]*\]|\[\/[a-z]+\]/i",'',preg_replace("/\[attach\]\d+\[\/attach\]/i",'',$message)); 寫入數據庫 if(submitcheck('tijiao')) { $setarr = array( 'tid' => $_GET['topicid'], 'name' => $_POST['name'], 'position' => $_GET['position'], 'dateline' => $_G['timestamp'], ); DB::insert('forum_poststick', $setarr, 1); $query = DB::query("UPDATE ".DB::table('forum_thread')." SET stickreply='1' WHERE tid='$tid'"); $query = DB::query("DELETE FROM ".DB::table('forum_post')." WHERE pid='$pid'"); showmessage('成功的提示信息', "forum.php?mod=viewthread&tid=$tid"); } 表單提交:
以下兩個時間格式是對等關系 date("Ymd",time()); 20150212 FROM_UNIXTIME(dateline, '%Y%m%d') 前者用于PHP,后者用于數據庫調用的字段的格式化 調用圖片附件 數據庫循環嵌套調用 $slide[name] ucenter無法登錄: 打開uc_server/model/admin.php 找到第22行的 $this->cookie_status = 0; 改成 $this->cookie_status = isset($_COOKIE['sid']) ? 1 : 0; 無刷新切換li標簽并且同時加載框架頁面: 快速發帖 發布新話題 常用詞匯 select 選擇 count 總數 table 表 where 條件 result 結果 perpage 每頁 curpage 當前頁 update 更新 delete 刪除 insert 寫入 dateline 日期 time 時間 echo 輸出 multi 分頁函數 if 如果 else 否則 elseif start 起始 limit 限制 limit 10 DESC 倒序 ASC 正序PHP Debug
No. | File | Line | Code |
1 | forum.php | 73 | discuz_database::query(%s) |
2 | source/class/discuz/discuz_database.php | 136 | db_driver_mysql->query(%s, false, false) |
3 | source/class/db/db_driver_mysql.php | 153 | db_driver_mysql->halt(false, %d, %s) |
4 | source/class/db/db_driver_mysql.php | 224 | break() |