<%@ LANGUAGE="VBSCRIPT" %> <% Dim user_id,id,oprice,dprice,desc,bname,conn,recordSet,prodSet,message,inssql,squant,sname,uid username = Session("id") if((""+username) = "undefined") Then username = null Response.Write(username) else if((username=null) OR (username="")) Then Response.Redirect("login_ind11.asp?dest=allprod2buy.asp") end if end if 'Response.Write Session("id") Set conn = Server.CreateObject ("ADODB.Connection") conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("indreshdatabase.mdb") & ";" recordSet = Server.CreateObject("ADODB.Recordset") prodSet = Server.CreateObject("ADODB.RecordSet") '--- item name id = Request.QueryString("id") Response.Write(id) if((""+id) = "undefined") Then id = null else Response.Cookies("buyid")=id strsql1="select * from products where prod_id='"& Request("id") &"';" ' Response.Write(strsql1) Set recordSet=conn.execute(strsql1) if(Not recordSet.EOF) Then id = recordSet("prod_id") bname=recordSet("pname") quant=""+Request.Form("quantity") oprice=recordSet("originalprice") dprice=recordSet("disprice") desc=recordSet("description") ' ldesc=recordSet("lDesc") user_id=session("id") Response.Write("
You have bought:
") Response.Write(bname) Response.Write("
") message=null strsql2="select * from buytable;" 'Response.Write(strsql2) 'Response.Write("
id") 'Response.Write(id) 'Response.Write("
bname") 'Response.Write(bname) 'Response.Write("
desc") 'Response.Write(desc) 'Response.Write("
quant") 'Response.Write(quant) 'Response.Write("
oprice") 'Response.Write(oprice) 'Response.Write("
dprice") 'Response.Write(dprice) 'Response.Write("
") 'Response.Write("
user_id") 'Response.Write(user_id) 'Response.Write("
") prodSet=conn.execute(strsql2) 'prodSet.AddNew() if((""+id) = "undefined") Then ' Response.Write("id undefined1") id = null Else ' Response.Write("id defined1") ' prodSet("id")=id if((id <> "")AND((""+id)<>""))Then ' Response.Write("id not null") sname = bname Response.Write(sname) if((sname = "undefined")OR(sname="")) Then ' Response.Write("sname undefined") sname = null Else ' Response.Write("sname defined") ' prodSet("bname")=sname if((desc= "undefined")OR(desc="")) Then ' Response.Write("desc undefined") desc = null Else ' Response.Write("desc defined") ' prodSet("desc")=desc squant = Request.Cookies("quant") ' if(( squant = "undefined")OR( squant="")) Then ' Response.Write("squant undefined") ' squant = null ' Else ' Response.Write("squant defined") ' prodSet("quant")=squant uid=id if(( uid = "undefined")OR(uid="")) Then ' Response.Write("uid undefined") uid = null Else ' Response.Write("uid defined") ' prodSet("user_id")=uid if((sname=null)OR(desc=null)OR(squant=null))Then Response.Write("Please complete all the fields") else inssql="INSERT INTO buytable ([id],[bname],[desc],[quant],[user_id],[no])VALUES('"& Request("id") & "','"& Request("sname") & "','"& Request("desc") & "',12,'"& Request("user_id") & "','""');" Response.Write(inssql) set prodSet=conn.execute(inssql) end if end if ' prodSet.ReSync() ' prodSet.MoveFirst() ' recordSet.MoveNext() 'end if end if end if end if end if end if ' Wend END IF %>