Click to See Complete Forum and Search --> : save data
fyanym
05-15-2005, 11:01 PM
i want to save data to the database, i have some textbox create using for loop, like product&p (product1, product2,product3......) and desp&p (desp1,desp2,desp3....)
how to i save this textbox value to the database by using sql statement?
i m trying to work with this code but it doest work
str_sql ="Insert Into temp ( product, desp, ) Values " _
& "'"&(request("product&p"))&"', " _
& "'"&cQuote(request("desp&p"))&"')"
buntine
05-15-2005, 11:20 PM
Try this:
str_sql ="Insert Into temp (product, desp) Values ('" _
& request("product" & CStr(p)) & "', '" _
& cQuote(request("desp" & CStr(p))) & "');"
Regards.
fyanym
05-16-2005, 01:34 AM
its doesnt work...it save empty data in the database...when i check it using
a= Request("product" & CStr(p))
response.write(a)
it print nothing....
buntine
05-16-2005, 02:47 AM
Again, what does p equal? Are you passing it from the referring page?
fyanym
05-16-2005, 02:52 AM
thanx alot
phpnovice
05-16-2005, 07:28 AM
how to i save this textbox value to the database by using sql statement?
i m trying to work with this code but it doest work
str_sql ="Insert Into temp ( product, desp, ) Values " _
& "'"&(request("product&p"))&"', " _
& "'"&cQuote(request("desp&p"))&"')"
Something like this -- using your own connection object, of course:
For p = 1 to 3
If Len(Request.Form("product" & p)) > 0 Then
str_sql = "Insert Into temp (product, desp) Values(" _
"'" & Request.Form("product" & p) & "'," _
"'" & cQuote(Request.Form("desp" & p)) & "');"
objConn.Execute str_sql
End If
Next