V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  Sukizen  ›  全部回复第 66 页 / 共 68 页
回复总数  1345
1 ... 58  59  60  61  62  63  64  65  66  67 ... 68  
2012-12-13 02:23:19 +08:00
回复了 perrydu 创建的主题 问与答 有哪些CentOS 6搭建VPN的方法推荐?
@isy mac或iOS上都是服务器没响应。好奇怪。
2012-12-10 12:17:52 +08:00
回复了 Sukizen 创建的主题 MySQL SELECT时候,如何处理某字段空值?
@fangzhzh 再次感谢。
新手学语言,还是测试一次最能吸收。
昨天测试过了,DESC LIMIT 10 我知道什么意思,我复制代码提问的时候,忘记去掉了,谢谢你的提醒。

我因为要或者不同类型的数据,导致一个页面查询很多次,不知道有什么好的方法让查询次数少一点呢。
以下是我在对discuz作修改的时候加入的代码,请赐教。
我的想法:
1、获取新主题,但是过滤上级论坛分类 ( fup not in (6) ),过滤匿名发表的主题(author !='')。
2、获取最近回复的主题,同样论坛分类 6 ( fup not in (6) ),过滤匿名发表的主题(author !='')。
3、由于上级论坛分类6是一个原创专区,所以我单独获取这个分区的最新帖子。

//newthread start
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
$hack_cut_str = 50;
$hack_cut_strauthor = 9;
$new_post_threadlist = array();
$nthread = array();
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE f.fup not in (6) AND t.fid<>'$fid' AND f.fid=t.fid AND f.fid not in (0) AND t.displayorder not in (-1,-2) AND author !='' ORDER BY t.dateline DESC LIMIT 0, 20");
while($nthread = $db->fetch_array($query)) {
$nthread['forumname'] = strip_tags($nthread['name']);
$nthread['view_subject'] = cutstr($nthread['subject'],$hack_cut_str);
$nthread['view_author'] = cutstr($nthread['author'],$hack_cut_strauthor);
$nthread['date'] = dgmdate("$dateformat $timeformat", $nthread['dateline'] + $timeoffset * 3600);
$nthread['lastreplytime']= dgmdate("$dateformat $timeformat", $nthread[lastpost] + ($timeoffset * 3600));
if($nthread['highlight']) {
$string = sprintf('%02d', $nthread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$nthread['highlight'] = 'style="';
$nthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$nthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$nthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$nthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$nthread['highlight'] .= '"';
} else {
$nthread['highlight'] = '';
}
$new_post_threadlist[] = $nthread;
}
//newthread end

//newreply start
$new_reply_threadlist = array();
$rthread = array();
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE f.fup not in (6) AND t.fid<>'$fid' AND f.fid=t.fid AND t.closed NOT LIKE 'moved|%' AND t.replies !=0 AND f.fid not in (0) AND t.displayorder not in (-1,-2) AND author !='' ORDER BY t.lastpost DESC LIMIT 0, 20");
while($rthread = $db->fetch_array($query)) {
$rthread['forumname'] = ereg_replace('<[^>]*>','',$rthread['name']);
$rthread['view_subject'] = cutstr($rthread['subject'],$hack_cut_str);
$rthread['view_lastposter'] = cutstr($rthread['lastposter'],$hack_cut_strauthor);
$rthread['date']= dgmdate("$dateformat $timeformat", $rthread['dateline'] + $timeoffset * 3600);
$rthread['lastreplytime']= dgmdate("$dateformat $timeformat", $rthread[lastpost] + ($timeoffset * 3600));
if($rthread['highlight']) {
$string = sprintf('%02d', $rthread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$rthread['highlight'] = 'style="';
$rthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$rthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$rthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$rthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$rthread['highlight'] .= '"';
} else {
$rthread['highlight'] = '';
}
$new_reply_threadlist[] = $rthread;
}
//newreply end

//myspace start
$my_post_threadlist = array();
$mythread = array();
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE f.fup in (6) AND t.fid<>'$fid' AND f.fid=t.fid AND f.fid not in (0) AND t.displayorder not in (-1,-2) AND author !='' ORDER BY t.dateline DESC LIMIT 0, 20");
while($mythread = $db->fetch_array($query)) {
$mythread['forumname'] = strip_tags($mythread['name']);
$mythread['view_subject'] = cutstr($mythread['subject'],$hack_cut_str);
$mythread['view_author'] = cutstr($mythread['author'],$hack_cut_strauthor);
$mythread['date'] = dgmdate("$dateformat $timeformat", $mythread['dateline'] + $timeoffset * 3600);
$mythread['lastreplytime']= dgmdate("$dateformat $timeformat", $mythread[lastpost] + ($timeoffset * 3600));
$my_post_threadlist[] = $mythread;
}
//myspace end
2012-12-10 01:28:06 +08:00
回复了 soulhacker 创建的主题 分享发现 美味爱读 ReadWise.net
@Sunng digwhy@gmail thx!
2012-12-09 14:57:29 +08:00
回复了 Sukizen 创建的主题 MySQL SELECT时候,如何处理某字段空值?
@fangzhzh 请教一下:
如果我只想得出 authorid 是 1 的数据,并且按照时间排序。下面语句是否正确:
$sql = "SELECT author,tags,subject,tid,authorid,dateline,fid FROM threads WHERE authorid ='1' ORDER BY dateline DESC LIMIT 10"
推荐 HEAD FIRST PYTHON.
2012-12-07 10:59:18 +08:00
回复了 Sukizen 创建的主题 MySQL SELECT时候,如何处理某字段空值?
@regmach 感谢!
因为我的空值是 ''
所以我根据你的找出了

$sql = "SELECT author,tags,subject,tid,authorid,dateline,fid FROM threads WHERE tags !='' ORDER BY dateline DESC LIMIT 10"

并且是有效的。
不要等到期才转,转入新的注册商一般会收取转入费并且延期一年(等于续费)
GD的优惠还是挺多的,而且价格也算不错的。
如果怕被墙,建议用DNSPOD。
2012-12-01 01:45:40 +08:00
回复了 Snow 创建的主题 分享创造 静雅思听FM
webkit也不能正常使用。
而且,扒得有点差。。。。
2012-11-30 17:48:17 +08:00
回复了 shellex 创建的主题 分享创造 UserScripts - 干掉V2EX上所有使用默认头像的用户的发言
看来我这类的人被隔离了。。。。。。我可不想随便上传一个图片代表自己。
2012-11-30 17:21:15 +08:00
回复了 haichong520 创建的主题 分享创造 微小乐,一个简单的,纯粹的,分享音乐的地方
@ray1980 地址在页面源文件中搜索.mp3
2012-11-30 15:41:42 +08:00
回复了 jooe 创建的主题 问与答 大家有用Host Virtual的VPS么
我刚换了一个20刀的,原来的10刀还在。都是香港机房。
@ltzliwe 有一个旗鱼的复数 Sailfishes , 有一个 lichess 荔枝???
2012-11-27 02:18:22 +08:00
回复了 plprapper 创建的主题 站长 风云主机倒闭了,坑爹!
@qq286735628 现在GODADDY还有送免费空间吗?话说我在上面买了很多域名,却不知道这回事。。。
2012-11-27 02:14:03 +08:00
回复了 cosbeta 创建的主题 SSD 大家有没有觉得mbp 128G SSD已经足够了 ?
那个时候我还觉得128MB的内存就足够了,不能对比呀。

128GB的硬盘的话,一定要考虑一个Time Capsule
但如果你只写代码,那也够了。
@loddit 不是,纯字母。
@loddit 四字母应该还有很多的。现在普遍市场上是 200块-500块。话说那天我还抢注到一个被删除的四字母,还是热门搜索词的首字母。
1 ... 58  59  60  61  62  63  64  65  66  67 ... 68  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3603 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 48ms · UTC 10:36 · PVG 18:36 · LAX 03:36 · JFK 06:36
Developed with CodeLauncher
♥ Do have faith in what you're doing.