返回列表 發帖

帶入某些SQl值後出不來資料

本帖最後由 kikiwang0625 於 2013-6-28 21:51 編輯

自己想了很多天, 也一直不段重覆改了很多次, 但就是無法解決, 想詢問大大~~~先謝謝大家!!
我目前利用了2種jQUERY合在一起, 一種是http://ucmic.blogspot.tw/2011/05/jqueryjquery-include-html.html (jQuery Include HTML、插入html、jquery替代iframe)
另一種則是可收合的垂直選單


目前有2個頁面, MV.ASP、MV2.ASP
MV.ASP左側選單是依SQL查詢後產生的垂直選單, 選單連結後會在MV.ASP裡的<DIV ID=IFRAME>裡切換, 頁面為MV2.ASP, 依參數切換.

MV2.ASP有3種工作: 1. 記錄點擊率、2. 顯示依連結帶出該有的影片及相關資料、3. 將該影片的同類影片前10名點擊率最高的列出
目前MV2.ASP的點擊率以及帶出該影片己可正常顯示, 但是不知為什麼, 帶出前10名的select條件打上去, 還未列出, 就只是打了select而己. 而網頁卻點了不換頁了.

MV.ASP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jquery include HTML</title>
<script type="text/javascript" src="js/jquery-1.6.min.js"></script>



<script type="text/JavaScript">

$(document).ready(function(){ 
$.get("a.html",function(data){ //初始將a.html include div#iframe
$("#iframe").html(data);
}); 

$(function(){
$('#menu li').click(function() {
                // 找出 li 中的超連結 href(#id)
        var $this = $(this),
        _clickTab = $this.find('a').attr('href'); // 找到連結a中的targer標籤值
        $.get(_clickTab,function(data){
        $("#iframe").html(data);        
        });
        return false
})
})
});
</script>

    <script type="text/javascript">
    function initMenu() {
  $('#menu ul').hide();
  $('#menu ul').children('.current').parent().show();
  //$('#menu ul:first').show();
  $('#menu li a').click(
    function() {
      var checkElement = $(this).next();
      if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
        return false;
        }
      if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
        $('#menu ul:visible').slideUp('normal');
        checkElement.slideDown('normal');
        return false;
        }
      }
    );
  }
$(document).ready(function() {initMenu();});
    
    </script>
    
    


    <style>
body {
        font-family: Helvetica, Arial, sans-serif;
        font-size: 0.9em;
        background-color: #CCC;
}
p {
        line-height: 1.5em;
}
ul#menu, ul#menu ul {
        list-style-type:none;
        margin: 0;
        padding: 0;
        width: 15em;
}
ul#menu a {
        display: block;
        text-decoration: none;
}
ul#menu li {
        margin-top: 1px;
}
ul#menu li a {
        background: #333;
        color: #fff;
        padding: 0.5em;
}
ul#menu li a:hover {
        background: #000;
}
ul#menu li ul li a {
        background: #ccc;
        color: #000;
        padding-left: 20px;
}
ul#menu li ul li a:hover, ul#menu li ul .current a {
        background: #aaa;
        border-left: 5px #000 solid;
        padding-left: 15px;
}
#Lmenu {
        padding: 10px;
        min-height: 200px;
        float: left;
        height: 100%;
}

#iframe {
        padding: 10px;
        min-height: 400px;
        float: left;
}
#hotmv {
        padding: 10px;
        min-height: 400px;
        float: left;
}

.mmuser {
        width: 100%;

}
.menu li a:hover {
        background-color: #666;
        color: #FFF;
}
    </style>

</head>

    <!--[if lt IE 8]>
   <style type="text/css">
   li a {display:inline-block;}
   li a {display:block;}
    </style>
   <![endif]-->

<body>
<% Response.Charset="utf-8"
Session.Codepage=65001 %>
<!--#INCLUDE FILE="../conn.asp"-->
<%set conn=session("conn")%>


<%
set mv1= Server.CreateObject("ADODB.recordset") 
conn=session("conn")
mv1.Open "select * from mv1 where display='1' and mv_type='1' order by mid", conn, 2, 2 
%>   
<div id="Lmenu">
    <ul id="menu">

<% if not mv1.eof then%>                      
<% DO WHILE NOT mv1.EOF%>
<%LFcolor=LFcolor+1%>
<%if (LFcolor mod 2)=1 then
        bgcolors="#FFFFFF"
        titlefonts="#FFFFFF"
  else
    bgcolors="#94D6CF"
        titlefonts="#333333"
  End if
%>

<%set mv2= Server.CreateObject("ADODB.recordset") 
mv2.Open "select * from mv2 where mv1_id="&mv1("mid")&" and display='1' order by mid", conn, 2, 2 
%>                                                        

<li><a href="#"><%=mv1("name")%></a>
<ul>
                
<% if not mv2.eof then%>                      
<% DO WHILE NOT mv2.EOF%>

<li><a href="mv2.asp?MID=<%=mv2("mid")%>&sid=<%=mv2("mv1_id")%>"><%=mv2("subject")%></a></li>

<% mv2.MOVENEXT          
LOOP   %>   
<%end if%>       
 
        </ul>
      </li>


<% mv1.MOVENEXT          
LOOP   %>   
<%end if%>       
              </ul>
                </div>
        

  






<div id="iframe">
<!--jquery 插入html 位址-->
</div>

</body>
</html>
MV2.ASP
<% Response.Charset="utf-8"
Session.Codepage=65001 %>
<!--#INCLUDE FILE="../conn.asp"-->

<%
set conn=session("conn")
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open "update mv2 set clicktotal=clicktotal+1 where mid="&request("mid")&"",conn,3,3
%>

<%set conn=session("conn")%>

<%
set mv3= Server.CreateObject("ADODB.recordset") 
conn=session("conn")
mv3.Open "select * from mv2 where display='1' and mid="&request("mid")&"", conn, 2, 2 
%>   
<%if not mv3.eof then        %>

<p>目前播放的影片是:<%=mv3("subject")%>/<%=mv3("clicktotal")%></p>
<p><iframe width="480" height="360" src="http://www.youtube.com/embed/<%=mv3("youtube_code")%>" frameborder="0" allowfullscreen></iframe></p>
<p>影片說明:<%=basename(mv3("mdesc"))%></p>
<%end if%>

<!--就是加了以下的資料後, 頁面就開不出來了-->
<%
set mvrs= Server.CreateObject("ADODB.recordset")
mvrs.Open "select * from mv2 where display='1'  and mv1_id="&request("sid")&" ", conn, 2, 2 
%>

回復 2# wmh

感謝大大的回覆...

    若單獨mv2.asp不含mv.asp, 則完全可以正常顯示. 而且沒有任何出錯, 左下角也無黃色警示. 就只是點了左邊選單. 右邊沒反應.

TOP

回覆大大~~~我是用IE+Chrome, 2種同時檢查, 都沒顯示錯誤碼

TOP

問題已解決了. 拍勢啦...


現在又有新的問題產生, 但我想先自己試..qq

TOP

結論是在MV2.ASP下方加一行.
<%mv3.close%>
即可...
只是我把mv.asp 第144行  mv1.Open "select * from mv1 where display='1' and mv_type='1' order by mid", conn, 2, 2
mv_type='1' 改成2...又讀不出來了....傻眼.

TOP

返回列表 回復 發帖