Author |
Topic  |
|
hejsan
Starting Member
37 Posts |
Posted - 30 May 2001 : 09:02:41
|
Can someone please tell me whats wrong? I want my users to choose true or false in a checkbox.
<% if (RS("check1") = true) then %> <input type="checkbox" value=<%=rs("check1")%> checked name="check1"> <% else %> <input type="checkbox" value=<%=rs("check1")%> name="check1"> <% end if%>
strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.CHECK1 "
Then it complains about: Syntax error in UPDATE statement. /snitzforum/inc_profile.asp, line 884
And 884 is: my_Conn.Execute(strSql)
|
|
big9erfan
Average Member
  
540 Posts |
|
hejsan
Starting Member
37 Posts |
Posted - 30 May 2001 : 09:52:56
|
case "EditIt"
Err_Msg = "" if Request.Form("Name") = "" then Err_Msg = Err_Msg & "<li>You must choose a UserName</li>" end if if (Instr(Request.Form("Name"), ">") > 0 ) or (Instr(Request.Form("Name"), "<") > 0) then Err_Msg = Err_Msg & "<li> > and < are not allowed in the UserName, Please Choose Another</li>" end if if strAuthType = "db" then if Request.Form("Password") = "" then Err_Msg = Err_Msg & "<li>You must choose a Password</li>" end if if Len(Request.Form("Password")) > 25 then Err_Msg = Err_Msg & "<li>Your Password can not be greater than 25 characters</li>" end if if Request.Form("Password") <> Request.Form("Password2") then Err_Msg = Err_Msg & "<li>Your Passwords didn't match.</li>" end if end if if Request.Form("Email") = "" then Err_Msg = Err_Msg & "<li>You Must give an email address</li>" end if if EmailField(Request.Form("Email")) = 0 then Err_Msg = Err_Msg & "<li>You Must enter a valid email address</li>" end if if (lcase(left(Request.Form("Homepage"), 7)) <> "http://") and (lcase(left(Request.Form("Homepage"), 8)) <> "https://") and (Request.Form("Homepage") <> "") then Err_Msg = Err_Msg & "<li>You Must prefix your URL with <b>http://</b> or <b>https://</b></li>" end if if strUniqueEmail = "1" then if lcase(Request.Form("Email")) <> lcase(Request.Form("Email2")) then '## Forum_SQL strSql = "SELECT M_EMAIL FROM " & strMemberTablePrefix & "MEMBERS " strSql = strSql & " WHERE M_EMAIL = '" & Trim(Request.Form("Email")) &"'"
set rs = my_Conn.Execute (strSql)
if rs.BOF and rs.EOF then '## Do Nothing - proceed Else Err_Msg = Err_Msg & "<li>Email Address already in use, Please Choose Another</li>" end if rs.close set rs = nothing ' ################### Email Password Mod #################### if lcase(strEmail) = "1" then strPassword = emailPassword() end if ' ########################################################### end if ' ################### Email Password Mod #################### else if lcase(Request.Form("Email")) <> lcase(Request.Form("Email2")) and lcase(strEmail) = "1" then strPassword = emailPassword() end if ' ########################################################### end if if Len(ChkString(Request.Form("Sig"),"message")) > 255 then Err_Msg = Err_Msg & "<li>Your signature can not be greater than 255 characters. " Err_Msg = Err_Msg & "It now is <b>" & Len(ChkString(Request.Form("Sig"),"message")) & "</b> characters long.</li>" end if if Err_Msg = "" then if Trim(Request.Form("Homepage")) <> "" and lcase(trim(Request.Form("Homepage"))) <> "http://" and Trim(lcase(Request.Form("Homepage"))) <> "https://" then regHomepage = ChkString(Request.Form("Homepage"),"url") else regHomepage = " " end if if Trim(Request.Form("LINK1")) <> "" and lcase(trim(Request.Form("LINK1"))) <> "http://" and Trim(lcase(Request.Form("LINK1"))) <> "https://" then regLink1 = ChkString(Request.Form("LINK1"),"url") else regLink1 = " " end if if Trim(Request.Form("LINK2")) <> "" and lcase(trim(Request.Form("LINK2"))) <> "http://" and Trim(lcase(Request.Form("LINK2"))) <> "https://" then regLink2 = ChkString(Request.Form("LINK2"),"url") else regLink2 = " " end if if Trim(Request.Form("PHOTO_URL")) <> "" and lcase(trim(Request.Form("PHOTO_URL"))) <> "http://" and Trim(lcase(Request.Form("PHOTO_URL"))) <> "https://" then regPhoto_URL = ChkString(Request.Form("Photo_URL"),"url") else regPhoto_URL = " " end if
'## Forum_SQL strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS " ' ####################### Email Password Mod ############################ if lcase(Request.Form("Email")) <> lcase(Request.Form("Email2")) and lcase(strEmail) = "1" then strSql = strSql & " SET M_PASSWORD = '" & ChkString(strPassword,"") & "', " else strSql = strSql & " SET M_PASSWORD = '" & ChkString(Request.Form("Password"),"") & "', " end if ' ####################################################################### strSql = strSql & " M_COUNTRY = '" & ChkString(Request.Form("Country"),"") & "', " strSql = strSql & " M_HIDE_EMAIL = " & Request.Form("HideMail") & ", " strSql = strSql & " CHECK1 = " & Request.Form("check1") & ", " if strICQ = "1" then strSql = strSql & " M_ICQ = '" & ChkString(Request.Form("ICQ"),"") & "', " end if if strYAHOO = "1" then strSql = strSql & " M_YAHOO = '" & ChkString(Request.Form("YAHOO"),"") & "', " end if if strAIM = "1" then strSql = strSql & " M_AIM = '" & ChkString(Request.Form("AIM"),"") & "', " end if if strHOMEPAGE = "1" then strSql = strSql & " M_Homepage = '" & ChkString(Trim(regHomepage),"") & "', " end if strSql = strSql & " M_SIG = '" & ChkString(Request.Form("Sig"),"message") & "', " strSql = strSql & " M_EMAIL = '" & ChkString(Request.Form("Email"),"") & "' " if strfullName = "1" then strSql = strSql & ", M_FIRSTNAME = '" & ChkString(Request.Form("FirstName"),"") & "'" strSql = strSql & ", M_LASTNAME = '" & ChkString(Request.Form("LastName"),"") & "'" end if if strCity = "1" then strsql = strsql & ", M_CITY = '" & ChkString(Request.Form("City"),"") & "'" end if if strState = "1" then strsql = strsql & ", M_STATE = '" & ChkString(Request.Form("State"),"") & "'" end if 'strsql = strsql & ", M_HIDE_EMAIL = '" & ChkString(Request.Form("HideMail"),"") & "'" if strPicture = "1" then strsql = strsql & ", M_PHOTO_URL = '" & ChkString(Request.Form("Photo_URL"),"") & "'" end if if strFavLinks = "1" then strsql = strsql & ", M_LINK1 = '" & ChkString(Request.Form("LINK1"),"") & "'" strSql = strSql & ", M_LINK2 = '" & ChkString(Request.Form("LINK2"),"") & "'" end if if strAge = "1" then strSql = strsql & ", M_AGE = '" & ChkString(Request.Form("Age"),"") & "'" end if if strMarStatus = "1" then strSql = strSql & ", M_MARSTATUS = '" & ChkString(Request.Form("MarStatus"),"") & "'" end if if strSex = "1" then strSql = strsql & ", M_SEX = '" & ChkString(Request.Form("Sex"),"") & "'" end if if strOccupation = "1" then strSql = strSql & ", M_OCCUPATION = '" & ChkString(Request.Form("Occupation"),"") & "'" end if if strBio = "1" then strSql = strSql & ", M_BIO = '" & ChkString(Request.Form("Bio"),"message") & "'" end if if strHobbies = "1" then strSql = strSql & ", M_HOBBIES = '" & ChkString(Request.Form("Hobbies"),"message") & "'" end if if strLNews = "1" then strsql = strsql & ", M_LNEWS = '" & ChkString(Request.Form("LNews"),"message") & "'" end if if strQuote = "1" then strSql = strSql & ", M_QUOTE = '" & ChkString(Request.Form("Quote"),"message") & "'" end if strSql = strSql & " WHERE M_NAME = '" & Request.Form("Name") & "' " if strAuthType = "db" then strSql = strSql & " AND M_PASSWORD = '" & Request.Form("Password-d") & "'" end IF
my_Conn.Execute(strSql) |
 |
|
big9erfan
Average Member
  
540 Posts |
Posted - 30 May 2001 : 10:15:05
|
I don't see what would be causing the error, but I don't see you trying to update the checkbox value either.
http://www.ugfl.net/forums |
 |
|
hejsan
Starting Member
37 Posts |
Posted - 30 May 2001 : 14:32:39
|
What should I write for update then?
I have a checkbox, where my members could choose if it should be checked or not of course... :-)
I´ve made a table in FORUM_MEMBERS called CHECK1.
Edited by - hejsan on 30 May 2001 15:27:43 |
 |
|
Davio
Development Team Member
    
Jamaica
12217 Posts |
Posted - 30 May 2001 : 16:28:15
|
Just to let you know, if you don't specify a value for the checkbox, the Checkboxes return "on" if they are checked and they return nothing if it wasn't checked.
I don't see how this:<input type="checkbox" value=<%=rs("check1")%> name="check1"> code in red will ever get a value. Put a value into it like so<input type="checkbox" value="true" name="check1"> Then, you can check if RS("check1") = true.
|
 |
|
hejsan
Starting Member
37 Posts |
Posted - 30 May 2001 : 17:13:09
|
But if I set value to True, how can my members then uncheck it? |
 |
|
Davio
Development Team Member
    
Jamaica
12217 Posts |
Posted - 31 May 2001 : 00:00:16
|
If they check it, the value will be stored in the database. If they un-check it, it will store a null value in the database.
Or you can check to see if the checkbox is checked or not when the user submits and store "true" or "false" into the database, instead of checking for a null value.
dim strChecked <% if Request.Form("check1") = "on" then %> strChecked = true <% else %> strChecked = false <% end if %>
Then change the SQL statement to:
strSql = strSql & " CHECK1 = " & strChecked & ", "
That way, it will store true or false in the database. And that will be easy to check.
<% if RS("check1") = true then %> <input type="checkbox" checked name="check1"> <% else %> <input type="checkbox" name="check1"> <% end if %>
|
 |
|
hejsan
Starting Member
37 Posts |
Posted - 31 May 2001 : 09:03:31
|
IT WORKED!!! :-)
Thanks a lot! |
 |
|
Davio
Development Team Member
    
Jamaica
12217 Posts |
Posted - 31 May 2001 : 10:25:27
|
But of course!!  You're Welcome.
|
 |
|
|
Topic  |
|
|
|