Forums
This topic is locked
global variable problem
Posted 06 Jan 2006 14:29:55
1
has voted
06 Jan 2006 14:29:55 sameh shohdy posted:
hello, i'm sorry but i use java script code and declare variable as global but his value not seen in code <%
id_dept=0 // variable not change
counter=0
main=0
i=0;
ConnectObj = Server.CreateObject("ADODB.Connection"
![](/images/forum/smilies/icon_smile_wink.png)
RS = Server.CreateObject("ADODB.Recordset"
![](/images/forum/smilies/icon_smile_wink.png)
ConnectObj.ConnectionString = "DSN=Min_Museum"
sql="SELECT * FROM departments where parent_id=0";
ConnectObj.Open
RS.Open(sql, ConnectObj)
while(!RS.EOF)
{
main++
RS.Movenext();
}
RS.Close()
RS.Open(sql, ConnectObj)
if(!RS.EOF)
{Flag=1;
%>
<div><div><div style="display:none;">
<ul id="imenus0" style="width:525px">
<%
}
for(loop=0;loop<main;loop++)
{
RS.Close()
RS.Open(sql, ConnectObj)
counter=0
while(!RS.EOF)
{
if(counter==i)
{
id_dept=RS("dept_id"
![](/images/forum/smilies/icon_smile_wink.png)
%>
<li style="width:152px;"><a href="#" ><%=RS("dept_name"
![](/images/forum/smilies/icon_smile_wink.png)
<%
break
}
counter=counter+1
RS.Movenext()
}
RS.Close()
%>
<%
i2=0
main2=0
Flag2=0
loop2=0
sql22="SELECT * FROM departments where parent_id="+id_dept;
//****************************Here id_dept='';
RS.Open(sql22, ConnectObj)
while(!RS.EOF)
sameh shohdy