Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - desp. updating record prob
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

desp. updating record prob

 Post Reply Post Reply Page  <12
Author
funki View Drop Down
Newbie
Newbie
Avatar

Joined: 06 March 2003
Location: United Kingdom
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote funki Quote  Post ReplyReply Direct Link To This Post Posted: 06 March 2003 at 11:13am

 

Okay hers goes

result first from response.write

looks like act and userID which are the only two numbers in record set are not being populated. everythig else is loaded. So Morning Z & gary thanks for helping  me to open my eyes will look at variable passing from previous pages. Will respond if succesfull or not.

PS thanks again at least I not hitting my head against the wall so hard.

Back to Top
funki View Drop Down
Newbie
Newbie
Avatar

Joined: 06 March 2003
Location: United Kingdom
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote funki Quote  Post ReplyReply Direct Link To This Post Posted: 06 March 2003 at 11:32am

Here is how I populate variables from previous form page.

userID=session("userID")
fname = TRIM(request("fname"))
sname = TRIM(request("sname"))
uname = TRIM(request("uname"))
pswd = TRIM(request("pswd"))
addra = TRIM(Request("addra"))
addrb = TRIM(Request("addrb"))
county = TRIM(Request("county"))
postcode = TRIM(Request("postcode"))
telno = TRIM(Request("telno"))
fax = TRIM(Request("fax"))
email=Trim(Request("email"))
act=0

Below the First number is printed using <%=userID%> so the value is there but not when it comes to being included in SQL. IN additon as you can see from above I also hard code act number into page but this also does not show  any suggestions guys . What am I doing wrong.

2 --- Update users Set fname='tom', sname='jones' , uname='jones', pswd='tom', addra='Docks', addrb='Docks', county='', postcode='CF1', telno='0292 678678', fax='xxxx', email='jfvkjsdhf@.', act= Where userID=

Back to Top
Gary View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 March 2002
Location: United Kingdom
Status: Offline
Points: 326
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gary Quote  Post ReplyReply Direct Link To This Post Posted: 06 March 2003 at 11:45am

1. Are you sure that the UserID session variable is being set ?

2. Please post the entire code again

Back to Top
funki View Drop Down
Newbie
Newbie
Avatar

Joined: 06 March 2003
Location: United Kingdom
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote funki Quote  Post ReplyReply Direct Link To This Post Posted: 06 March 2003 at 12:00pm

          Here is all the code for this page - to give you brief login using uname and pswd, - passed to userwelcome page which queries for userID which is then stored as session  passedonto profile diplay page where userID is taken from session and passed on as hdden field in form. UserID appears on final page the one listed below as you will not from my last message - hope I have not confused situation  .   

<%

'Collating all the information from the form using the the request command.

 

userID=session("userID")
fname = TRIM(request("fname"))
sname = TRIM(request("sname"))
uname = TRIM(request("uname"))
pswd = TRIM(request("pswd"))
addra = TRIM(Request("addra"))
addrb = TRIM(Request("addrb"))
county = TRIM(Request("county"))
postcode = TRIM(Request("postcode"))
telno = TRIM(Request("telno"))
fax = TRIM(Request("fax"))
email=Trim(Request("email"))

act=0


'Error checking of the element that make up the form

if fname = "" then

 strError = strError & "Enter your first name.<BR>"
 
end if
if sname = "" then

 strError = strError & "Enter your surname.<BR>"
 
end if
if uname = "" then

 strError = strError & "Enter a user name.<BR>"
 
end if
if pswd = "" then

 strError = strError & "Enter a password .<BR>"
 
end if


if addra = "" then

 strError = strError & "Enter in your address line 1.<BR>"
end if

if addrb = "" then

 strError = strError & "Enter  in your address line 2.<BR>"
end if


if county = "" then

 strError = strError & "Enter  in your City or County.<BR>"
end if

if  postcode="" then
 strError = strError & "Enter your Postcode <BR>"

end if

if telno = "" then

 strError = strError & "Enter  your Telephone<BR>"

end if

if email="" then
strError = strError & " Enter your email<br>"
else
if (instr(1, email,"@")=0) or (instr(1, email, ".")=0) then
strError = strError & " Invalid email<br>"
end if
end if

 

' if there are any error they will be picked up by this next term

if strError <> "" then

%>
                    <!-- Note the error -->
                    <b> There is an error in your registration request: </b> </span>
                  <p> <span class="error">
                    <%

 '  Write out the error messages
 Response.Write strError

%>
                    </span> <br>
                    Click <a href="userupdate.asp" class="purp">here</a>
                    to update.
                    <%

 ' If there are any probelms with form the  information is placed into sessionvariable
 ' for when you are sent back to last page.
 
Session("fname") = request("fname")
Session("sname") = Request("sname")
Session("uname") = Request("uname")
Session("pswd") = Request("pswd")
Session("addra") = Request("addra")
Session("addrb") = Request("addrb")
session("county") = Request("county")
Session("postcode") = Request("postcode")
Session("telno") = Request("telno")
Session("fax") = Request("fax")
Session("email") = Request("email")

else
%>
<font>   <% = userID %></font>
<%

Set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open = "DRIVER={Microsoft Access Driver (*.mdb)};" & _
    "DBQ=" & Server.MapPath("db2.mdb") & ";"
 
sql1 = "Update users Set fname='" & request.form("fname") & "', sname='" & request.form("sname") & "' , uname='" & request.form("uname") & "', pswd='" & request.form("pswd") & "', addra='" & request.form("addra") & "', addrb='" & request.form("addrb") & "', county='" & request.form("county ")& "', postcode='" & request.form("postcode") & "', telno='" & request.form("telno") & "', fax='" & request.form("fax") & "', email='" & request.form("email") & "', act=" & request.form("act") & " Where userID=" & request.form("userID")& ""

Response.Write(sql1)
Response.End

MyConn.Execute(sql1)
%>

Back to Top
Gary View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 March 2002
Location: United Kingdom
Status: Offline
Points: 326
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gary Quote  Post ReplyReply Direct Link To This Post Posted: 06 March 2003 at 12:11pm

Revised sql statement.....

sql1 = "Update users Set fname='" & request.form("fname") & "', sname='" & request.form("sname") & "' , uname='" & request.form("uname") & "', pswd='" & request.form("pswd") & "', addra='" & request.form("addra") & "', addrb='" & request.form("addrb") & "', county='" & request.form("county ")& "', postcode='" & request.form("postcode") & "', telno='" & request.form("telno") & "', fax='" & request.form("fax") & "', email='" & request.form("email") & "', act=" & act & " Where userID=" & UserID

Notice that I changed the 'act' and 'userid' parts towards the end.

Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.