![]() |
| |||||||
| Sponsored Links |
![]() | « Previous Thread | Next Thread » |
| | LinkBack | Thread Tools | Display Modes |
|
#1
| |||
| |||
| hi, I have a problem in my code I have it in such a way where the user can select a size and then add different colors and logos to the size so right now the user select size as "S" then he selects 2 colors Brown Red Brown he selects one logo -- RS logo Red he selects 2 logo -- DFlogo, RS logo but it only adds Red color and DFlogo and not Rs logo for red color it doesnt add brown logo in the table also can someone tell me whats wrong with my loop todd Code:
<!--#include file="Loader.asp"-->
<%
Response.Buffer = True
Set load = new Loader
load.initialize
fileData = load.getFileData("file")
fileName = LCase(load.getFileName("file"))
filePath = load.getFilePath("file")
filePathComplete = load.getFilePathComplete("file")
fileSize = load.getFileSize("file")
fileSizeTranslated = load.getFileSizeTranslated("file")
contentType = load.getContentType("file")
fileData1 = load.getFileData("file1")
fileName1 = LCase(load.getFileName("file1"))
filePath1 = load.getFilePath("file1")
filePathComplete1 = load.getFilePathComplete("file1")
fileSize1 = load.getFileSize("file1")
fileSizeTranslated1 = load.getFileSizeTranslated("file1")
contentType1 = load.getContentType("file1")
fileData2 = load.getFileData("file2")
fileName2 = LCase(load.getFileName("file2"))
filePath2 = load.getFilePath("file2")
filePathComplete2 = load.getFilePathComplete("file2")
fileSize2 = load.getFileSize("file2")
fileSizeTranslated2 = load.getFileSizeTranslated("file2")
contentType2 = load.getContentType("file2")
countElements = load.Count
cat = load.getValue("cat")
subcat = load.getValue("subcat")
txtisbn = load.getValue("txtisbn")
txtitem = load.getValue("txtitem")
txtchk = load.getValue("txtchk")
txtprice = load.getValue("txtprice")
txtmemberprice = load.getValue("txtmemberprice")
txtkeywords = load.getValue("txtkeywords")
txtdescription = load.getValue("txtdescription")
date1 = load.getValue("date1")
userip = load.getValue("userip")
size = load.getValue("size")
size = Split(trim(size),",")
color = load.getValue("color")
logo = load.getValue("logo")
color = Split(trim(color),",")
logo = Split(trim(logo),",")
Set load = Nothing
Set rsprodcheck = Server.CreateObject("ADODB.Recordset")
sqlprodcheck="Select *From Products1 where Sub_Item='" & txtchk & "'"
rsprodcheck.Open sqlprodcheck, connStr, 2, 2
If not rsprodcheck.Eof then
Response.write "This item already exists"
Else
Set rscat= Server.CreateObject("adodb.RecordSet")
strcat = "Select Sub_Id from Sub_Categories where Cat_Id = '" & cat & "' and Sub_Cat_Name='" & subcat & "'"
rscat.Open strcat, connStr, 2, 2
subid=rscat("Sub_Id")
Set rsprodadd = Server.CreateObject("ADODB.Recordset")
sqlprodadd="Select * From Products1"
rsprodadd.Open sqlprodadd, connStr, 2, 2
Featured="No"
Specials="No"
InStore="Yes"
rsprodadd.AddNew
rsprodadd("Cat_Id") = cat
rsprodadd("Sub_Id") = subid
rsprodadd("Product_Code") = txtisbn
rsprodadd("Sub_Item") = txtitem
rsprodadd("Cover_Picture").AppendChunk fileData
rsprodadd("Large_Picture").AppendChunk fileData1
rsprodadd("Store_Picture").AppendChunk fileData2
rsprodadd("Featured") = Featured
rsprodadd("Specials") = Specials
rsprodadd("InStore") = InStore
rsprodadd("IP_Address") = userip
rsprodadd("Added_By") = adminname
rsprodadd("DateTimeAdded") = date1
rsprodadd.Update
rsprodadd.Close
Set rsprodadd = Nothing
sqlprodid="Select Max(Product_Id) as Newest From Products1 where Sub_Item='" & txtchk & "'"
Set RecSet = connStr.Execute(sqlprodid)
ID = RecSet("Newest")
RecSet.Close()
Dim salePrice,instoring
instoring="Yes"
salePrice="0.00"
Set rsprice = Server.CreateObject("ADODB.Recordset")
sqlprice="Select * From Products_Price"
rsprice.Open sqlprice, connStr, 2, 2
rsprice.AddNew
rsprice("Product_Id") = ID
rsprice("Price") = txtprice
rsprice("Member_Price") = txtmemberprice
rsprice("Sale_Price") = salePrice
rsprice("InStore") = instoring
rsprice("IP_Address") = userip
rsprice("Added_By") = adminname
rsprice("DateTimeAdded") = date1
rsprice.Update
rsprice.Close
Set rsprice = Nothing
Set rsdesc = Server.CreateObject("ADODB.Recordset")
sqldesc="Select * From Product_Description"
rsdesc.Open sqldesc, connStr, 2, 2
rsdesc.AddNew
rsdesc("Product_Id") = ID
rsdesc("Keywords") = txtkeywords
rsdesc("Description") = txtdescription
rsdesc("InStore") = InStore
rsdesc("IP_Address") = userip
rsdesc("Added_By") = adminname
rsdesc("DateTimeAdded") = date1
rsdesc.Update
rsdesc.Close
Set rsdesc = Nothing
Dim sqlproddetails,rsproddetails
Dim i,j,k,m,n
Dim arrColor, arrLogo
Dim sTempSize, sTempColor, sTempLogo
Set rsproddetails = Server.CreateObject("ADODB.Recordset")
sqlproddetails="Select * From Products_Details"
rsproddetails.Open sqlproddetails, connStr, 2, 2
For i=0 to UBound(size)
sTempSize=""
If Trim(size(i)) = "None" then
sTempSize="None"
stempColor="None"
sTempLogo="None"
rsproddetails.AddNew
rsproddetails("Product_Id") = ID
rsproddetails("Sizes") = sTempSize
rsProddetails("Color")=sTempColor
rsProddetails("logo")=sTempLogo
rsProddetails("Qty_Hand")="0"
rsProddetails("InStore") = InStore
rsProddetails("IP_Address") = userip
rsProddetails("Added_By") = adminname
rsProddetails("DateTimeAdded") = date1
rsproddetails.Update
End if
If Trim(size(i))<> "" then
sTempSize=trim(size(i))
For j= 0 to UBound(color)
sTempCOlor=""
If trim(color(j)) <> "" then
sTempColor=Mid(Trim(color(j)),Instr(1,trim(color(j)),"#")+1)
Response.Write sTempColor &"<br/>"
Response.Write (Mid(Trim(color(j)),1,Instr(1,trim(color(j)),"#")-1))
If Mid(Trim(color(j)),1,Instr(1,trim(color(j)),"#")-1)=sTempSize then
For k= 0 to UBound(logo)
sTempLogo=""
if Trim(logo(k)) <> "" then
sTempLogo=Mid(Trim(logo(k)),(InstrRev(trim(logo(k)),"#",-1))+1)
Response.Write sTempLogo & "<br>"
'Response.Write
'Mid(Trim(logo(k)),(Instr(1,trim(logo(k)),"#")+1),(InstrRev(trim(logo(k)),"#",-1)-(Instr(1,trim(logo(k)),"#")+1)))
If Mid(Trim(logo(k)),(Instr(1,trim(logo(k)),"#")+1),(InstrRev(trim(logo(k)),"#",-1)-(Instr(1,trim(logo(k)),"#")+1)))= sTempColor then
If not CheckDuplicateProduct(stempsize,sTempColor,sTempLogo) then
rsproddetails.AddNew
rsproddetails("Product_Id") = ID
rsproddetails("Sizes") = sTempSize
rsProddetails("Color")=sTempColor
rsProddetails("logo")=sTempLogo
rsProddetails("InStore") = InStore
rsProddetails("IP_Address") = userip
rsProddetails("Added_By") = adminname
rsProddetails("DateTimeAdded") = date1
rsproddetails.Update
End if
End if
End if
Next
End if
End if
Next
End if
Next
rsproddetails.Close
Set rsproddetails = Nothing
Response.write "Item added Successfully"
%>
<%
Function CheckDuplicateProduct(size,color,logo)
Dim sqlDuplicateProduct,rsDuplicateProduct
Set rsDuplicateProduct = Server.CreateObject("ADODB.Recordset")
sqlDuplicateProduct="Select * From Products_Details where Sizes='" & size & "'" & " and Color='" & color & "'" & " and Logo='" & logo & "'"
rsDuplicateProduct.Open sqlDuplicateProduct, connStr,3,2
Response.write rsDuplicateProduct.RecordCount
If rsDuplicateProduct.RecordCount >= 1 then
Response.write "I am here "
CheckDuplicateProduct= true
Else
Response.write "I am not here "
CheckDuplicateProduct=false
End if
End Function
%>
<%
End if
%>
|
| Sponsored Links |
|
#3
| |||
| |||
| Shadow here is the code which adds the size, color, logo to the table thanks for ur help Code: For i=0 to UBound(size)
sTempSize=""
If Trim(size(i)) = "None" then
sTempSize="None"
stempColor="None"
sTempLogo="None"
rsproddetails.AddNew
rsproddetails("Product_Id") = ID
rsproddetails("Sizes") = sTempSize
rsProddetails("Color")=sTempColor
rsProddetails("logo")=sTempLogo
rsProddetails("Qty_Hand")="0"
rsProddetails("InStore") = InStore
rsProddetails("IP_Address") = userip
rsProddetails("Added_By") = adminname
rsProddetails("DateTimeAdded") = date1
rsproddetails.Update
End if
If Trim(size(i))<> "" then
sTempSize=trim(size(i))
For j= 0 to UBound(color)
sTempCOlor=""
If trim(color(j)) <> "" then
sTempColor=Mid(Trim(color(j)),Instr(1,trim(color(j)),"#")+1)
Response.Write sTempColor &"<br/>"
Response.Write (Mid(Trim(color(j)),1,Instr(1,trim(color(j)),"#")-1))
If Mid(Trim(color(j)),1,Instr(1,trim(color(j)),"#")-1)=sTempSize then
For k= 0 to UBound(logo)
sTempLogo=""
if Trim(logo(k)) <> "" then
sTempLogo=Mid(Trim(logo(k)),(InstrRev(trim(logo(k)),"#",-1))+1)
Response.Write sTempLogo & "<br>"
'Response.Write
'Mid(Trim(logo(k)),(Instr(1,trim(logo(k)),"#")+1),(InstrRev(trim(logo(k)),"#",-1)-(Instr(1,trim(logo(k)),"#")+1)))
If Mid(Trim(logo(k)),(Instr(1,trim(logo(k)),"#")+1),(InstrRev(trim(logo(k)),"#",-1)-(Instr(1,trim(logo(k)),"#")+1)))= sTempColor then
If not CheckDuplicateProduct(stempsize,sTempColor,sTempLogo) then
rsproddetails.AddNew
rsproddetails("Product_Id") = ID
rsproddetails("Sizes") = sTempSize
rsProddetails("Color")=sTempColor
rsProddetails("logo")=sTempLogo
rsProddetails("InStore") = InStore
rsProddetails("IP_Address") = userip
rsProddetails("Added_By") = adminname
rsProddetails("DateTimeAdded") = date1
rsproddetails.Update
End if
End if
End if
Next
End if
End if
Next
End if
Next
|
|
#4
| ||||
| ||||
| what you see on the screen? do you see what you expect? if not, what is missing? maybe this part: Code: If Mid(Trim(logo(k)),(Instr(1,trim(logo(k)),"#")+1),(InstrRev(trim(logo(k)),"#",-1)-(Instr(1,trim(logo(k)),"#")+1)))= sTempColor then |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| loop update statement | peebman2000 | SQL Development | 2 | August 7th, 2008 10:04 AM |
| Loop / Summary help | Rebelle | ASP Development | 7 | April 11th, 2008 10:12 AM |