MySQL存储过程-通过数据库里已存在的IP查询城市

CREATE DEFINER=`mazey`@`%` PROCEDURE `sp_find_city_by_ip`(IN `in_visitor_ip` varchar(20),OUT `out_visitor_city` varchar(100))
BEGIN
select visitor_city into out_visitor_city
from record_visitor
where visitor_ip = in_visitor_ip
and timestampdiff(hour,visitor_time,now())<72
limit 1;
if out_visitor_city is null or out_visitor_city = '' THEN
set out_visitor_city=0;
end if;
END

#测试:

call sp_find_city_by_ip('64.74.215.1',@result);
select @result;

HTML/CSS/JS初始化

CSS
<link type="text/css" href="http://www.mazey.net/css/mazey-base.css" rel="stylesheet" />

jQuery
2.1.1
<script language="javascript" type="text/javascript" src="http://www.mazey.net/js/plugin/jquery/jquery-2.1.1.min.js"></script>

Layer
<script language="javascript" type="text/javascript" src="http://www.mazey.net/js/plugin/layer/layer.js"></script>
<script language="javascript" type="text/javascript" src="http://www.mazey.net/js/plugin/layer/mazey-layer.js"></script>

Bootstrap
<link type="text/css" href="http://www.mazey.net/config/frame/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<script language="javascript" type="text/javascript" src="http://www.mazey.net/config/frame/bootstrap/js/bootstrap.min.js"></script>

ASP跳出FOR循环

由于ASP不能使用GOTO语句,我在FOR循环中加入一个FOR循环,若需要跳出,即退出最里面那个FOR循环。
DEMO:

<%
dim a
a = 0
for i = 1 to 10
for j = 1 to 1
a = a + 1
if i = 5 then    'a=5不会输出
exit for
end If
Response.write a & "<br/>"
next
next
%>

ASP获取上月本月下月的第一天和最后一天

上月第一天:

<%=dateadd("m",-1,year(date)&"-"&month(date)&"-1")%>

上月最后一天:

<%=dateadd("d",-1,year(date)&"-"&month(date)&"-1")%>

本月第一天:

<%=year(date)&"-"&month(date)&"-1"%>

本月最后一天:

<%=dateadd("d",-1,dateadd("m",1,year(date)&"-"&month(date)&"-1"))%>

下月第一天:

<%=dateadd("m",1,year(date)&"-"&month(date)&"-01")%>

下月最后一天:

<%=dateadd("d",-1,dateadd("m",2,year(date)&"-"&month(date)&"-01"))%>

HTML友情链接代码

早些时候写的,记录一下。

<div align="center">
    <table width="980" height="35" border="0" align="center">
        <tr>
            <td>
                友情链接:&nbsp;
                <a target="_blank" href="#">One</a>
                &nbsp;|&nbsp;
                <a target="_blank" href="#">Two</a>
                &nbsp;|&nbsp;
                <a target="_blank" href="#">Three</a>
                &nbsp;|&nbsp;
                <a target="_blank" href="# ">Four</a>
                &nbsp;|&nbsp;
                <a target="_blank" href="#">Five</a>
                &nbsp;|&nbsp;
                <a target="_blank" href="#">Six</a>
                &nbsp;|&nbsp;
                <a target="_blank" href="#">Seven</a>
                &nbsp;|&nbsp;
                <a target="_blank" href="#">Eight</a>
                &nbsp;|&nbsp;
                <a target="_blank" href="#">Nine</a>
                &nbsp;|&nbsp;
                <a target="_blank" href="#">Ten</a>
                &nbsp;|&nbsp;
                <a target="_blank" href="#">Eleven</a>
            </td>
        </tr>
    </table>
</div>