hii guys

I have a code below in combination of php and vbscript...the problem is in the vbscript portion... the sub routine "downloadData_onclick()" , in that the first query is getting executed but 'qry2' is not getting executed. can anyone tell me why i have been stuck on this...or if i can place the qry2 somewhere else in the code plss tell me where i can put that

<html>

<body>


<?php


$db1 = mysql_connect('localhost', 'mysql', '');

mysql_select_db("nihserver",$db1);

$result = mysql_query("SELECT * FROM nihserver.queries2 where saveFlag = 1",$db1);

$data = ( bool )false;


while ( $res = mysql_fetch_row($result) )
{
$row_data = implode( '|', $res );
$data .= $row_data . '*' . "\n";
}

mysql_close($db1);

$result4= mysql_query("update nihserver.queries2 SET saveFlag = 2 where saveFlag = 1");
?>

<form method="POST" action="--WEBBOT-SELF--">
<button name="downloadData">Transfer data</button>
</form>


<script language="VBScript">

sub downloadData_onclick()
s = txtQueryData.value

': Queries

dim conn
dim rs
dim connStr
dim qry
dim qry2
Set conn = createObject("ADODB.Connection")
conn.CursorLocation = 3
set rs = createObject("adodb.recordset")
conn.Open "TestDB"

msgbox "hi"

arr = split(s,"*")

qryDataCnt = ubound(arr)

msgbox qryDataCnt

for i = lbound(arr) to ubound(arr)
queryArr = split(arr(i),"|")
queryID = queryArr(0)
formName = queryArr(1)
'day = queryArr(2)
eleName = queryArr(3)
MRN=queryArr(4)
queryType = queryArr(5)
queryTitle = queryArr(6)
query = queryArr(7)

queryDate1 = queryArr(8)
queryDate=cdate(queryDate1)
answer = queryArr(9)

answerDate1=queryArr(10)
answerDate = cdate(answerDate1)

site = queryArr(11)
userID = queryArr(12)
user = queryArr(13)
saveFlag = queryArr(14)
queryTime = queryArr(15)


qry = "Insert into
Queries2(queryID,formName,eleName,MRN,queryType,queryTitle,query,queryDate,answer,answerDate,site,us erID,user,saveFlag,queryT

ime) " & _
"values (" & queryID & ",'" & formName & "','" & eleName & "','" & MRN & "','" &

queryType & "','" & queryTitle & "','" & query & "','" & queryDate & "','" & answer & "','" & answerDate & "','" & site &

"','" & userID & "','" & user & "','" & saveFlag & "','" & queryTime & "') "

conn.execute qry
erase queryArr
next
'msgbox "QueryData successfully downloaded.",,""
txtQueryData.value = ""

qry2 = "Update Queries2 Set saveFlag = 2 Where ((saveFlag = 1))"
conn.Execute qry2

conn.close
set rs = nothing
set conn = nothing

erase arr
end sub

</script>

<br><input type="hidden" name="txtDBname2" size="20" value="NIH">
<br><input type="hidden" name="txtDBtable2" size="20" value="Observations">
<br><input type="hidden" name="txtWhichWay2" size="20">

<br>&nbsp;<input type="hidden" name="txtQueryData" size="20" value="<?=$data?>">

</body>
</html>

thanks so much

ravi