How to create an action page that will save the info to the database?

Dear EE,

I would like to ask EE for tech support on how will I create the Action Page for this form:
http://www.cssasia.info/ipix/login/ste-iphoto-signup.asp
I'm attaching my codes so can check the form of that page.

- After the user filled up the form, a "Thank You" page will come out and have a message to kindly wait for the activation of their registration.
- An email should be sent to the user too, regarding their registration.
(We can't make it automatic activation, as we need to check the group level of the users, then we need to activate it manually)
- Another email should be sent to the Admin that a new user signed up & need to activate their profile
- connected on that email, a link should be provided where an Admin can go & activate the profile of the new user & set the group level of that user.

I've created steproducts db, and have several tables inside. Have tables of Group, Members, etc.
Inside Group table, it has 6 fields (Admin, PMSP, PMMS, Domestic, International, & UploadUser)
Inside Members table, it has 11 fields (UserID, Name, Surname, Username, Password, Email, Telephone, Mobile, Company, Address, GroupID)

In whereas the GroupID will determine the group level of the user.
<%@LANGUAGE="VBSCRIPT"%>
<%
function TestCaptcha(byval valSession, byval valCaptcha)
	dim tmpSession
	valSession = Trim(valSession)
	valCaptcha = Trim(valCaptcha)
	if (valSession = vbNullString) or (valCaptcha = vbNullString) then
		TestCaptcha = false
	else
		tmpSession = valSession
		valSession = Trim(Session(valSession))
		Session(tmpSession) = vbNullString
		if valSession = vbNullString then
			TestCaptcha = false
		else
			valCaptcha = Replace(valCaptcha,"i","I")
			if StrComp(valSession,valCaptcha,1) = 0 then
				TestCaptcha = true
			else
				TestCaptcha = false
			end if
		end if		
	end if
end function
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head>


<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">

<meta name="GENERATOR" content="Mozilla/4.7 [en] (Win98; I) [Netscape]">

<title>..:: Stiebel ::..</title>
<style TYPE="text/css">
<!--
	a
 	{
  		color:#000080;
		font-family:verdana;
		text-decoration:none;
		font-size:12px
	}
	
	
	a:active
 	{
  		color:red;

	}

	a:hover
 	{
  		color:#FF0000;
		text-decoration:none;
		cursor:crosshair;
	}
		
	table
	{
		font-family:verdana;
	}
	
	.td
	{
		font-family:verdana;
		font-size:12px;
	}

	.b
	{
		font-color:#FF0000;
		font-family:verdana;
		font-size:12px;
	}		

-->
</STYLE>

<!--validation-->

<script language="JavaScript" type="text/javascript">
if(!String.prototype.trim) {
  String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/, '');
  };
}

function isEmail(string) {
  return (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
}
function checkform ( form ) {
  // ** START **
  if (form.username.value.trim() == "") {
    alert( "Please enter your Username." );
    form.username.focus();
    return false ;
  }
  if (form.password.value.trim() == "") {
    alert( "Please enter your Password." );
    form.password.focus();
    return false ;
  }
  if (form.repassword.value.trim() == "") {
    alert( "Please retype your Password." );
    form.repassword.focus();
    return false ;
  }
  if (form.repassword.value.trim() != form.password.value.trim()) {
    alert( "Password didn't match. Please retype." );
    form.repassword.focus();
    return false ;
  }
  if (form.fname.value.trim() == "") {
    alert( "Please enter your name." );
    form.fname.focus();
    return false ;
  }
  if (form.lname.value.trim() == "") {
    alert( "Please enter your surname." );
    form.lname.focus();
    return false ;
  }
  if (form.company.value.trim() == "") {
    alert( "Please enter your company name." );
    form.company.focus();
    return false ;
  }
  if (form.address.value.trim() == "") {
    alert( "Please enter your address." );
    form.address.focus();
    return false ;
  }
  if (form.email.value.trim() == "") {
    alert( "Please enter your email address." );
    form.email.focus();
    return false ;
  }
  
  if (!isEmail(form.email.value.trim())) {
    alert("Please enter correct Email address");
	  form.email.focus();
	  return false;
  }

  if (form.telephone.value.trim() == "") {
    alert( "Please enter your Telephone#." );
    form.telephone.focus();
    return false ;
  }
  if (form.mobile.value.trim() == "") {
    alert( "Please enter your Mobile#." );
    form.mobile.focus();
    return false ;
  }
  if (form.code.value.trim() == "") {
    alert( "Please retype the confirmation code." );
    form.code.focus();
    return false ;
  }
//  if (form.remobile.value.trim() != form.mobile.value.trim()) {
//    alert( "Mobile didn't match. Please retype." );
//    form.remobile.focus();
//    return false ;
//  }
  
    // ** END **
    return true ; // allow submission
}
</script>
<!-- captcha image-->
<script language="javascript">
function RefreshImage(valImageId) {
	var objImage = document.images[valImageId];
	if (objImage == undefined) {
		return;
	}
	var now = new Date();
	objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();
}
</script>
<!--END-->

</head>

<body bgcolor="#CCCCCC">

<table width="760" border="0" cellspacing="3" cellpadding="1">
  <tr>
    <td width="134"><img src="../IMG/logo_res.jpg" alt="STIEBEL ELTRON" /></td>
    <td width="620" valign="bottom"><img src="../IMG/header-pic.jpg" width="750" height="122" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td align="right">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td align="left" bordercolor="#999999" bgcolor="#cccccc"><img src="../IMG/member.jpg" /><br></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>
    <table width="100%" border="1" bordercolor="#999999" cellpadding="0">
    <form name="form" id="form" method="post" action="signup_result.asp" onSubmit="return checkform(this)">

     <!--   <font face="verdana" size="1">    	-->
    	<tr>
        	<td class="td" width="20%" align="right">Username:</td>
	       	<td width="80%"><input id="username" name="username" type="text" size="25" maxlength="15" />&nbsp;<b><font class="b">*</font></b></td>
        </tr>
    	<tr>
        	<td class="td" width="20%" align="right">Password:</td>
           	<td width="80%"><input id="password" name="password" type="password" size="25" maxlength="15" />&nbsp;<b><font class="b">*</font></b></td>
        </tr>
    	<tr>
        	<td class="td" width="20%" align="right">Re-type Password:</td>
           	<td width="80%"><input id="repassword" name="repassword" type="password" size="25" maxlength="15" />&nbsp;<b><font class="b">*</font></b></td>
        </tr>
    	<tr>
        	<td class="td" width="20%" align="right">First Name:</td>
           	<td width="80%"><input id="fname" name="fname" type="text" size="50" maxlength="50" />&nbsp;<b><font class="b">*</font></b></td>
        </tr>
    	<tr>
        	<td class="td" width="20%" align="right">Last Name:</td>
           	<td width="80%"><input id="lname" name="lname" type="text" size="50" maxlength="50" />&nbsp;<b><font class="b">*</font></b></td>
        </tr>
    	<tr>
        	<td class="td" width="20%" align="right">Company:</td>
           	<td width="80%"><input id="company" name="company" type="text" size="50" maxlength="25" />&nbsp;<b><font class="b">*</font></b></td>
        </tr>
    	<tr valign="top">
        	<td class="td" width="20%" align="right">Address:</td>
           	<td width="80%"><textarea name="address" id="address" rows="4" cols="39"></textarea>&nbsp;<b><font class="b">*</font></b></td>
        </tr>
        <tr>
        	<td class="td" width="20%" align="right">Email:</td>
           	<td width="80%"><input id="email" name="email" type="text" size="50" maxlength="50" />&nbsp;<b><font class="b">*</font></b></td>
        </tr>
        <tr>
        	<td class="td" width="20%" align="right">Telephone:</td>
           	<td width="80%"><input id="telephone" name="telephone" type="text" size="25" maxlength="15" />&nbsp;<b><font class="b">*</font></b></td>
        </tr>
        <tr>
        	<td class="td" width="20%" align="right">Mobile:</td>
           	<td width="80%"><input id="mobile" name="mobile" type="text" size="25" maxlength="15" />&nbsp;<b><font class="b">*</font></b></td>
        </tr>

        <tr>
        	<td class="td" width="20%" align="right">Confirm code:&nbsp;
			</td> 
           	<td width="80%">
            <img id="imgCaptcha" src="captcha.asp" /><br /><a href="javascript:void(0)" onclick="RefreshImage('imgCaptcha')">Change Image</a><br />
            <input id="code" name="code" type="text" size="25" maxlength="15" />&nbsp;<b><font class="b">*</font></b></td>
        </tr>

        <tr>
        	<td class="td" width="20%" align="right">&nbsp;</td>
           	<td width="80%"><input name="Submit" type="submit" value="SUBMIT FORM" onclick="checkform();" />&nbsp;
            <input name="Reset" type="reset" value="RESET FORM" onClick="return confirm('Are you sure you want to reset the form?')" /></td>
        </tr>
		<%
		if not IsEmpty(Request.Form("Submit")) then
			Response.Write("<tr><td colspan=""2"" align=""center"">")
			if TestCaptcha("ASPCAPTCHA", Request.Form("captchacode")) then
			Response.Write("<b style=""color:#00CC33"">The code you enter verified.</b>")
			else
			Response.Write("<b style=""color:#FF0000"">You entered the wrong code.</b>")
			end if
			Response.Write("</td></tr>" & vbCrLf)
		end if
		%>


<!--    </font>-->
        </form>
    </table>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td align="center" bgcolor="#ffffff">
    	<a href = "javascript:history.back()"><font size="0.5e">BACK TO TOP</font></a>
    </td>
  </tr>
</table>

</body>
</html>

Open in new window

Stiebel EltronAsked:
Who is Participating?
 
MuffyBunnyCommented:
Yeah you don't want to include fields in the INSERT clause that wont be in the VALUES clause.

So if UserId is an auto-increment field, skip it entirely in your INSERT statement. The database will just do what it's supposed to do.

Another tip: You don't have to specify .Form with the request object. You can just use Request("fieldname") and the engine will find it. The only time you don't want to use this shorthand is if you are passing values in the Form object and in the URL string. It appears that you're only using form fields, so the short version will be fine.

Another tip: You can't set a string variable across multiple lines without using a continuation flag  (_) or starting another set statement. So the line break between your INSERT clause and your VALUES clause is the unterminated string constant problem. Also, if you put a space on either side of your &'s it's easier to look at.

Another tip: I noticed your table name is members, but your sql script was using Memberss

Another tip: Any value that could have a single quote in it (O'Connell, Bob's Autoland, etc...) should be set up to escape the single-quote character just in case. Do this with REPLACE(string, srchstr, replacestr)

So....
sqlContent = "INSERT INTO Memberss(Name, Surname, Username, Password, "
sqlContent = sqlContent & "Email, Telephone, Mobile, Company, Address) "
sqlContent = sqlContent & "VALUES ('" & REPLACE(Request("fname"), "'", "''") & "','"
sqlContent = sqlContent & REPLACE(Request("lname"), "'", "''") & "','" 
sqlContent = sqlContent & REPLACE(Request("username"), "'", "''") & "','"
sqlContent = sqlContent & REPLACE(Request("password"), "'", "''") & "','"
sqlContent = sqlContent & Request("email") & "','" & Request("telephone") & "','"
sqlContent = sqlContent & Request("mobile") & "','"
sqlContent = sqlContent & REPLACE(Request("company"), "'", "''") & "','"
sqlContent = sqlContent & REPLACE(Request("address"), "'", "''") & "')"

Open in new window


As for your groupId, if you're including it in the INSERT, it has to be in the VALUES. I'm confused as to where that value is supposed to come from. Is it one of your incoming form fields? Let me know and we'll make the adjustment in the above code.
0
 
MuffyBunnyCommented:
In your signup_result.asp file, you'll have to create a connection, run your sql, and then display the thank you.

Setting up your connection depends on a lot of different things about your network environment. Do you already know how to do that?
0
 
Stiebel EltronAuthor Commented:
Hi there MuffyBunny!

I'm sorry but I don't know how to do that. Would it be possible for you to tell on how to create that?

Thank you in advance!
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Stiebel EltronAuthor Commented:
BTW, I'm working this up thru our server hosted @ GoDaddy.com, using Windows Server 2008 and MySql as the database.
0
 
MuffyBunnyCommented:
I'll try to show you how to do this via an example.

Create a table with 2 columns. Name the table someTable and name the columns intWhateverId (int), and vchWhatever (varchar(50))

Code for page1.asp :
<form action="page2.asp" method="post" name="theform">
ID: <input type="text" name="intWhateverId" value=""><br>
Whatever: <input type="text" name="vchWhatever" value=""><br>
<input type="submit" name="submit" value="submit">
</form>

Open in new window


Code for page2.asp:
<%
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open connStr
sqlStr = "INSERT INTO someTable(intWhateverId, vchWhatever) "
sqlStr = sqlStr & "VALUES(" & request("intWhateverId") & ", '" & REPLACE(request("vchWhatever"), "'", "''") & "') "
Set rs = Server.CreateObject("ADODB.Recordset") 
Set rs = cn.Execute(sqlStr)
' there's no need to close the rs because it closed itself after performing an operation instead 
' of filling it with a value (a recordset)
cn.close
Set rs = Nothing
Set cn = Nothing
%>
<h1 align="center">Thank You</h1>

Open in new window


If you wanted to do a page where you read the contents of someTable :
<%
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open connStr
sqlStr = "SELECT intWhateverId, vchWhatever FROM someTable ORDER BY vchWhatever"
Set rs = Server.CreateObject("ADODB.Recordset") 
Set rs = cn.Execute(sqlStr)

'check if the recordset holds any values
If Not rs.eof Then
	rs.MoveFirst
	Do While Not rs.eof
%>
		ID = <%=rs("intWhateverId")%><br>
		Whatever = <%=rs("vchWhatever")%><br><br>
<%
		rs.MoveNext
	Loop
	'This time you close the rs because it was holding an open recordset
	rs.close
Else
%>
No Records
<%
End If

cn.close
Set rs = Nothing
Set cn = Nothing
%>

Open in new window


Now the extremely variable piece in all this code is the connStr variable. The value that variable holds depends completely on your environment. It's the connection string. If you dig around on GoDaddy's support site, you'll find out what your connection string should be. Here are a couple links that may help you figure it out:

http://community.godaddy.com/groups/web-hosting/forum/topic/asp-connection-string-to-mysql/

http://forums.asp.net/t/1035942.aspx/3/10?Connection+String+to+Access+Database+hosted+on+GoDaddy
0
 
Stiebel EltronAuthor Commented:
Sorry for late reply, I didn't had the chance to open my PC last week, because I'm always out of our office, that's why just now had the chance to check your advise.
I'll test what you advise and get back to you soon...

Thank you!
0
 
Stiebel EltronAuthor Commented:
I did already your page1 & page2.asp, I changed some items that corresponds to my server & it worked.
QUESTIONS:
1.) For what is the 3rd code that you advised?
2.) And where to put the email alert that if there's a new user signup, an email alert will be sent to the admin of the site.
3.) In whereas, after the Admin of the site received an email, the admin can go to the admin site in where he/she can set the level of the new user.
0
 
Stiebel EltronAuthor Commented:
Follow up question:
4.) While applying what you advised, I applied it to my signup_result.asp, but I got 500 Internal server error. I tried to change the field from what you advised to the field of my table, but got error.
I'm attaching the screenshot of my db with its Fields, kindly advise on how to apply it to the script that you gave me.
You can see there that the UserID & GroupID are set as an int. But the UserID is set as auto_increment.

Please advise...
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%  Option Explicit             %>
<%
dim myDb, seriesid, myConnection
Dim connectString, sqlContent, rsMembers

myDb = "steproducts"

connectString = "Driver={MySQL ODBC 3.51 Driver};SERVER=steproducts.db.7509682.hostedresource.com;DATABASE=" & myDb & ";UID=steproducts;PWD=Ste2010Aeg"

Set myConnection = Server.CreateObject("ADODB.Connection")
myConnection.Open connectString
sqlContent = "INSERT INTO Members(UserID, username, password) "
sqlContent = sqlContent & "VALUES(" & request("username") & ", '" & REPLACE(request("password"), "'", "''") & "') "

Set rsMembers = Server.CreateObject("ADODB.Recordset") 
Set rsMembers = myConnection.Execute(sqlContent)
' there's no need to close the rs because it closed itself after performing an operation instead 
' of filling it with a value (a recordset)
myConnection.close
Set rsMembers = Nothing
Set myConnection = Nothing
%>
<h1 align="center">Thank You</h1>

Open in new window

steproducts-db2.jpg
0
 
MuffyBunnyCommented:
The solution to your UserId being auto-increment is to not include it in your query:

sqlContent = "INSERT INTO Members(username, password) "
sqlContent = sqlContent & "VALUES(" & request("username") & ", '" & REPLACE(request("password"), "'", "''") & "') "

Open in new window



The 3rd code set was just an example to show you what to do if you need to create a recordset and display its contents. Showing you the difference between writing in an rs and reading from an rs.

As far as emailing goes, that's a whole new question. There are a lot of different ways to send email from classic ASP and it warrants a whole new discussion of its own.

"500 Internal Server Error" - do yourself a huge programming favor and turn off friendly errors in whatever browser you're using. 500 Internal Server Error is a generic error that the browsers spit out for almost all errors, instead of showing you the actual error output of the language you're using.

In Internet Explorer
1) On the Tools menu, click Internet Options.
2) On the Advanced tab, under the Browsing section, click to clear the Show friendly HTTP error messages check box, and then click OK.
3) Restart the browser.

In Firefox
1) Open up a new tab (CTRL+T) or window (CTRL+N).
2) Type in the addressbar: about:config.
3) In the filterbar type: error and press Enter.
4) Now set the value of the browser.xul.error_pages.enabled to true. Double clicking will do.
5) Restart Firefox.
0
 
MuffyBunnyCommented:
Once you've turned off your friendly errors, you'll get something more along the lines of :

Microsoft VBScript compilation error '800a0400'
Expected statement
/newCP/admin/lookup/lkpAgencies.asp, line 56

Makes things way easier to debug
0
 
Stiebel EltronAuthor Commented:
As per your script:
>> sqlContent = "INSERT INTO Members(username, password) "
sqlContent = sqlContent & "VALUES(" & request("username") & ", '" & REPLACE(request("password"), "'", "''") & "') " <<

How can I include the other items of the form such as fname, lname, email, address, etc.?

Do I need to copy the 2nd line again and again?

Please advise...

Thank you!
0
 
MuffyBunnyCommented:
use actual table field names in your INSERT INTO clause
use the names you used in your form in your VALUES clause

sqlContent = "INSERT INTO Members(username, password, name, surname, email, address) "
sqlContent = sqlContent & "VALUES(" & request("username") & ", '" & REPLACE(request("password"), "'", "''") & "', '"
sqlContent = sqlContent & REPLACE(request("fname"), "'", "''") & "', '" & REPLACE(request("lname"), "'", "''") & "', '"
sqlContent = sqlContent & request("email") & "', '" & REPLACE(request("address"), "'", "''") & "') "

Open in new window

0
 
Stiebel EltronAuthor Commented:
Hi MuffyBunny!
Regarding to Show friendly HTTP error messages check box, it's already uncheck because of other cases that I've encountered before. So I leave it uncheck.

Kindly check the attached code that I did & advise where did I get wrong, as I'm still receiving 500 Internal server error report.

From my thread ID: 35312142, as you can see the screenshot of my db, it has a GroupID field, which is (int) also, I was thinking of getting error because of this field. In whereas that GroupID field is related to Group table.

Please advise...
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%  Option Explicit             %>
<%
dim myDb, seriesid, myConnection
Dim connectString, sqlContent, rsMembers

myDb = "steproducts"

connectString = "Driver={MySQL ODBC 3.51 Driver};SERVER=steproducts.db.7509682.hostedresource.com;DATABASE=" & myDb & ";UID=steproducts;PWD=Ste2010Aeg"

Set myConnection = Server.CreateObject("ADODB.Connection")
myConnection.Open connectString
sqlContent = "INSERT INTO Members(Name, Surname, Username, Password, Email, Telephone, Mobile, Company, Address) "
sqlContent = sqlContent & "VALUES(" & request("username") & ", '" & REPLACE(request("password"), "'", "''") & "', '"
sqlContent = sqlContent & REPLACE(request("fname"), "'", "''") & "', '" & REPLACE(request("lname"), "'", "''") & "', '"
sqlContent = sqlContent & REPLACE(request("company"), "'", "''") & "', '" & REPLACE(request("address"), "'", "''") & "', '"
sqlContent = sqlContent & REPLACE(request("email"), "'", "''") & "', '" & REPLACE(request("telephone"), "'", "''") & "', '"
sqlContent = sqlContent & REPLACE(request("mobile"), "'", "''") & "') "

Set rsMembers = Server.CreateObject("ADODB.Recordset") 
Set rsMembers = myConnection.Execute(sqlContent)
' there's no need to close the rs because it closed itself after performing an operation instead 
' of filling it with a value (a recordset)
myConnection.close
Set rsMembers = Nothing
Set myConnection = Nothing
%>
<h1 align="center">Thank You</h1>

Open in new window

0
 
MuffyBunnyCommented:
Your GroupId is defined as not nullable, so yes, you will have to include it in every insert to Members. If this isn't your desired functionality, then you could set GroupId to be nullable. I saw that it wasn't part of your form. Is there a default value you plan to use?
0
 
Stiebel EltronAuthor Commented:
Actually, the GroupID shouldn't be shown to users, to Admin users only. Because when users signup, they don't know their group yet, right? So we're the one who needs to set their group. So,
- is my edited script correct? :-)
- how should I do with the GroupID?

The GroupID should be linked (related) to the Group table, in whereas inside that Group table has GroupID & GroupName

Hope to hear from you soon... :-)
0
 
MuffyBunnyCommented:
If you want to let people submit the form and create the member record without a group, use the following for your INSERT statement:

sqlContent = "INSERT INTO Members(Name, Surname, Username, Password, Email, Telephone, Mobile, Company, Address) "
sqlContent = sqlContent & "VALUES('" & REPLACE(request("fname"), "'", "''") & "', '" & REPLACE(request("lname"), "'", "''") & "', '"
sqlContent = sqlContent & request("username") & ", '" & REPLACE(request("password"), "'", "''") & "', '"
sqlContent = sqlContent & REPLACE(request("company"), "'", "''") & "', '" & REPLACE(request("address"), "'", "''") & "', '"
sqlContent = sqlContent & REPLACE(request("email"), "'", "''") & "', '" & REPLACE(request("telephone"), "'", "''") & "', '"
sqlContent = sqlContent & REPLACE(request("mobile"), "'", "''") & "') "

Open in new window


NOTE: In your code, you didn't have your fields in the same order. The order of the fields in the VALUES() clause has to be the same as the order of fields in the INSERT clause

If you already know the id of the group you want people to be assigned to by default (for example: 3), you can explicitly set that in your insert without it being anything that your end-user ever sees:
sqlContent = "INSERT INTO Members(Name, Surname, Username, Password, Email, Telephone, Mobile, Company, Address, GroupId) "
sqlContent = sqlContent & "VALUES('" & REPLACE(request("fname"), "'", "''") & "', '" & REPLACE(request("lname"), "'", "''") & "', '"
sqlContent = sqlContent & request("username") & ", '" & REPLACE(request("password"), "'", "''") & "', '"
sqlContent = sqlContent & REPLACE(request("company"), "'", "''") & "', '" & REPLACE(request("address"), "'", "''") & "', '"
sqlContent = sqlContent & REPLACE(request("email"), "'", "''") & "', '" & REPLACE(request("telephone"), "'", "''") & "', '"
sqlContent = sqlContent & REPLACE(request("mobile"), "'", "''") & "', 3) "

Open in new window

0
 
Stiebel EltronAuthor Commented:
Hi there MuffyBunny!

I did what you advised, I tried the 2 scripts that you mentioned above, but still I'm getting 500 Internal error. I don't know which part I'm wrong. I even re-arrange the fields from the signup form, correspond to the result page.
I'm attaching the codes that we're workin on. The 1st one is the signup page (Snippet ID=8116428), and the 2nd one is the signup_result page (Snippet ID=8116429).

Kindly advise which part I'm wrong why I'm still getting 500 Internal server error result.

Thank you!
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%  Option Explicit             %>
<%
dim myDb, seriesid, myConnection
Dim connectString, sqlContent, rsMembers

myDb = "steproducts"

connectString = "Driver={MySQL ODBC 3.51 Driver};SERVER=steproducts.db.7509682.hostedresource.com;DATABASE=" & myDb & ";UID=steproducts;PWD=Ste2010Aeg"

Set myConnection = Server.CreateObject("ADODB.Connection")
myConnection.Open connectString
sqlContent = "INSERT INTO Members(Name, Surname, Username, Password, Email, Telephone, Mobile, Company, Address, GroupId) "  
sqlContent = sqlContent & "VALUES('" & REPLACE(request("fname"), "'", "''") & "', '" & REPLACE(request("lname"), "'", "''") & "', '"  
sqlContent = sqlContent & request("username") & ", '" & REPLACE(request("password"), "'", "''") & "', '"  
sqlContent = sqlContent & REPLACE(request("email"), "'", "''") & "', '" & REPLACE(request("telephone"), "'", "''") & "', '"  
sqlContent = sqlContent & REPLACE(request("mobile"), "'", "''") & "', '" & REPLACE(request("company"), "'", "''") & "', '"  
sqlContent = sqlContent & REPLACE(request("address"), "'", "''") & "', 3) "

Set rsMembers = Server.CreateObject("ADODB.Recordset") 
Set rsMembers = myConnection.Execute(sqlContent)
' there's no need to close the rs because it closed itself after performing an operation instead 
' of filling it with a value (a recordset)
myConnection.close
Set rsMembers = Nothing
Set myConnection = Nothing
%>
<h1 align="center">Thank You</h1>

Open in new window

<%@LANGUAGE="VBSCRIPT"%>
<%
function TestCaptcha(byval valSession, byval valCaptcha)
	dim tmpSession
	valSession = Trim(valSession)
	valCaptcha = Trim(valCaptcha)
	if (valSession = vbNullString) or (valCaptcha = vbNullString) then
		TestCaptcha = false
	else
		tmpSession = valSession
		valSession = Trim(Session(valSession))
		Session(tmpSession) = vbNullString
		if valSession = vbNullString then
			TestCaptcha = false
		else
			valCaptcha = Replace(valCaptcha,"i","I")
			if StrComp(valSession,valCaptcha,1) = 0 then
				TestCaptcha = true
			else
				TestCaptcha = false
			end if
		end if		
	end if
end function
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head>


<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">

<meta name="GENERATOR" content="Mozilla/4.7 [en] (Win98; I) [Netscape]">

<title>..:: Stiebel ::..</title>
<style TYPE="text/css">
<!--
	a
 	{
  		color:#000080;
		font-family:verdana;
		text-decoration:none;
		font-size:12px
	}
	
	
	a:active
 	{
  		color:red;

	}

	a:hover
 	{
  		color:#FF0000;
		text-decoration:none;
		cursor:crosshair;
	}
		
	table
	{
		font-family:verdana;
	}
	
	.td
	{
		font-family:verdana;
		font-size:12px;
	}

	.b
	{
		font-color:#FF0000;
		font-family:verdana;
		font-size:12px;
	}		

-->
</STYLE>

<!--validation-->

<script language="JavaScript" type="text/javascript">
if(!String.prototype.trim) {
  String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/, '');
  };
}

function isEmail(string) {
  return (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
}
function checkform ( form ) {
  // ** START **
  if (form.username.value.trim() == "") {
    alert( "Please enter your Username." );
    form.username.focus();
    return false ;
  }
  if (form.password.value.trim() == "") {
    alert( "Please enter your Password." );
    form.password.focus();
    return false ;
  }
  if (form.repassword.value.trim() == "") {
    alert( "Please retype your Password." );
    form.repassword.focus();
    return false ;
  }
  if (form.repassword.value.trim() != form.password.value.trim()) {
    alert( "Password didn't match. Please retype." );
    form.repassword.focus();
    return false ;
  }
  if (form.fname.value.trim() == "") {
    alert( "Please enter your name." );
    form.fname.focus();
    return false ;
  }
  if (form.lname.value.trim() == "") {
    alert( "Please enter your surname." );
    form.lname.focus();
    return false ;
  }
  if (form.company.value.trim() == "") {
    alert( "Please enter your company name." );
    form.company.focus();
    return false ;
  }
  if (form.address.value.trim() == "") {
    alert( "Please enter your address." );
    form.address.focus();
    return false ;
  }
  if (form.email.value.trim() == "") {
    alert( "Please enter your email address." );
    form.email.focus();
    return false ;
  }
  
  if (!isEmail(form.email.value.trim())) {
    alert("Please enter correct Email address");
	  form.email.focus();
	  return false;
  }

  if (form.telephone.value.trim() == "") {
    alert( "Please enter your Telephone#." );
    form.telephone.focus();
    return false ;
  }
  if (form.mobile.value.trim() == "") {
    alert( "Please enter your Mobile#." );
    form.mobile.focus();
    return false ;
  }
  if (form.code.value.trim() == "") {
    alert( "Please retype the confirmation code." );
    form.code.focus();
    return false ;
  }
//  if (form.remobile.value.trim() != form.mobile.value.trim()) {
//    alert( "Mobile didn't match. Please retype." );
//    form.remobile.focus();
//    return false ;
//  }
  
    // ** END **
    return true ; // allow submission
}
</script>
<!-- captcha image-->
<script language="javascript">
function RefreshImage(valImageId) {
	var objImage = document.images[valImageId];
	if (objImage == undefined) {
		return;
	}
	var now = new Date();
	objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();
}
</script>
<!--END-->

</head>

<body bgcolor="#CCCCCC">

<table width="760" border="0" cellspacing="3" cellpadding="1">
  <tr>
    <td width="134"><img src="../IMG/logo_res.jpg" alt="STIEBEL ELTRON" /></td>
    <td width="620" valign="bottom"><img src="../IMG/header-pic.jpg" width="750" height="122" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td align="right">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td align="left" bordercolor="#999999" bgcolor="#cccccc"><img src="../IMG/member.jpg" /><br></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>
    <table width="100%" border="1" bordercolor="#999999" cellpadding="0">
    <form name="form" id="form" method="post" action="signup_result.asp" onSubmit="return checkform(this)">

    	<tr>
        	<td class="td" width="20%" align="right">First Name:</td>
           	<td width="80%"><input id="fname" name="fname" type="text" size="50" maxlength="50" />&nbsp;<b><font class="b">*</font></b></td>
        </tr>
    	<tr>
        	<td class="td" width="20%" align="right">Last Name:</td>
           	<td width="80%"><input id="lname" name="lname" type="text" size="50" maxlength="50" />&nbsp;<b><font class="b">*</font></b></td>
        </tr>

    	<tr>
        	<td class="td" width="20%" align="right">Username:</td>
	       	<td width="80%"><input id="username" name="username" type="text" size="25" maxlength="15" onkeyup="OnChangedUsername" />&nbsp;<b><font class="b">*</font></b>&nbsp;<input id="btnCheckAvailability" type="button" disabled="disabled" value="Check Availability" onclick="OnCheckAvailability();" />&nbsp;&nbsp;<div id="Available"></div></td>
        </tr>
    	<tr>
        	<td class="td" width="20%" align="right">Password:</td>
           	<td width="80%"><input id="password" name="password" type="password" size="25" maxlength="15" />&nbsp;<b><font class="b">*</font></b></td>
        </tr>
    	<tr>
        	<td class="td" width="20%" align="right">Re-type Password:</td>
           	<td width="80%"><input id="repassword" name="repassword" type="password" size="25" maxlength="15" />&nbsp;<b><font class="b">*</font></b></td>
        </tr>
        <tr>
        	<td class="td" width="20%" align="right">Email:</td>
           	<td width="80%"><input id="email" name="email" type="text" size="50" maxlength="50" />&nbsp;<b><font class="b">*</font></b>	
            </td>
        </tr>
        <tr>
        	<td class="td" width="20%" align="right">Telephone:</td>
           	<td width="80%"><input id="telephone" name="telephone" type="text" size="25" maxlength="15" />&nbsp;<b><font class="b">*</font></b></td>
        </tr>
        <tr>
        	<td class="td" width="20%" align="right">Mobile:</td>
           	<td width="80%"><input id="mobile" name="mobile" type="text" size="25" maxlength="15" />&nbsp;<b><font class="b">*</font></b></td>
        </tr>

    	<tr>
        	<td class="td" width="20%" align="right">Company:</td>
           	<td width="80%"><input id="company" name="company" type="text" size="50" maxlength="25" />&nbsp;<b><font class="b">*</font></b></td>
        </tr>
    	<tr valign="top">
        	<td class="td" width="20%" align="right">Address:</td>
           	<td width="80%"><textarea name="address" id="address" rows="4" cols="39"></textarea>&nbsp;<b><font class="b">*</font></b></td>
        </tr>

        <tr>
        	<td class="td" width="20%" align="right">Confirm code:&nbsp;
			</td> 
           	<td width="80%">
            <img id="imgCaptcha" src="captcha.asp" /><br /><a href="javascript:void(0)" onclick="RefreshImage('imgCaptcha')">Change Image</a><br />
            <input id="code" name="code" type="text" size="25" maxlength="15" />&nbsp;<b><font class="b">*</font></b></td>
        </tr>

        <tr>
        	<td class="td" width="20%" align="right">&nbsp;</td>
           	<td width="80%"><input name="Submit" type="submit" value="SUBMIT FORM" onclick="checkform();" />&nbsp;
            <input name="Reset" type="reset" value="RESET FORM" onClick="return confirm('Are you sure you want to reset the form?')" /></td>
        </tr>
		<%
		if not IsEmpty(Request.Form("Submit")) then
			Response.Write("<tr><td colspan=""2"" align=""center"">")
			if TestCaptcha("ASPCAPTCHA", Request.Form("captchacode")) then
			Response.Write("<b style=""color:#00CC33"">The code you enter verified.</b>")
			else
			Response.Write("<b style=""color:#FF0000"">You entered the wrong code.</b>")
			end if
			Response.Write("</td></tr>" & vbCrLf)
		end if
		%>


        </form>
        
        <!--javascript-->
        <script language="JavaScript" type="text/javascript">
		//If our user enters data in the username input, then we need to enable our button
function OnChangedUsername()
{
if(document.form.username.value == "")
{
document.form.btnCheckAvailability.disabled = true;
}
else
{
document.form.btnCheckAvailability.disabled = false;
}
}
function OnCheckAvailability()
{
if(window.XMLHttpRequest)
{
oRequest = new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
oRequest = new ActiveXObject("Microsoft.XMLHTTP");
}

oRequest.open("POST", "AJAX.asp", true);
oRequest.onreadystatechange = UpdateCheckAvailability;
oRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
oRequest.send("strCmd=availability&strUsername=" + document.form.username.value);
}
function UpdateCheckAvailability()
{
if(oRequest.readyState == 4)
{ 
if(oRequest.status == 200)
{
document.getElementById("Available").innerHTML = oRequest.responseText;
}
else
{
document.getElementById("Available").innerHTML = "Asychronous Error";
}
}
}
</script>
        <!--END-->
    </table>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td align="center" bgcolor="#ffffff">
    	<a href = "javascript:history.back()"><font size="0.5e">BACK TO TOP</font></a>
    </td>
  </tr>
</table>

</body>
</html>

Open in new window

0
 
MuffyBunnyCommented:
I already said this in an earlier post, but I'll post it again:

"500 Internal Server Error" - do yourself a huge programming favor and turn off friendly errors in whatever browser you're using. 500 Internal Server Error is a generic error that the browsers spit out for almost all errors, instead of showing you the actual error output of the language you're using.

In Internet Explorer
1) On the Tools menu, click Internet Options.
2) On the Advanced tab, under the Browsing section, click to clear the Show friendly HTTP error messages check box, and then click OK.
3) Restart the browser.

In Firefox
1) Open up a new tab (CTRL+T) or window (CTRL+N).
2) Type in the addressbar: about:config.
3) In the filterbar type: error and press Enter.
4) Now set the value of the browser.xul.error_pages.enabled to true. Double clicking will do.
5) Restart Firefox.
0
 
MuffyBunnyCommented:
Look at line 18 of the 1st script in your last post. I only used 3 as an example. Is that really the default groupID you want to use? If not, replace that 3 with the real groupID value that you want to be your default.
0
 
Stiebel EltronAuthor Commented:
I'm attaching the screenshot in regards to the 500 Internal error. I already replied to that on my browser in office it's clear already, no check, here on my laptop @ home, same (pls see the attached screenshot), but still I'm getting 500 Internal error.

For the default GroupID, I'll change it tomorrow as I'm here @home now.
500-InternalError.jpg
0
 
MuffyBunnyCommented:
Ok, that means you or someone else has set up custom error pages, which is great for the end-user, but a nightmare for the programmer. Honestly without the real error, I don't know what to tell you. We need to find out the line number and filename that's the source of the error. Go to your site and intentionally cause the error. For GoDaddy, you'll have to make sure that error logging is enabled

1. Log into your Account Manager
2. From the Products section, click Web Hosting
3. Next to the hosting account you want to use, click Launch
4. In the Settings section of the Hosting Control Center, click the Error Logs icon
5. Click Update

Now go intentionally cause your error in your site, then look at the error log

1. Log into your Account Manager
2. From the Products section, click Web Hosting
3. From the Content menu, select File Manager
4. From the directory structure that displays, click Error Logs

Let me know what it says



0
 
Stiebel EltronAuthor Commented:
I checked into my GoDaddy's account manager, I couldn't find the Error Logs. I can only see the "404 Error Options". When I click that icon, it has 3 options:
- Use home page
- Use custom page (http://www.cssasia.info/)
- Use GoDaddy.com, Inc.'s (Default 404 Error Page) - default selected

That's why I couldn't find the error logs from the FTP File Manager...
Hope to hear from you again soon...
0
 
MuffyBunnyCommented:
without the real error code, I don't know what else to tell you
0
 
MuffyBunnyCommented:
Contact GoDaddy and tell them you need to see your error logs. Have them explain to you how to get to them.
0
 
Stiebel EltronAuthor Commented:
Ok, will do that. And will get back to u after i got their response regarding that matter.
0
 
Stiebel EltronAuthor Commented:
@MuffyBunny: Sorry for the late reply, I went for my vacation that's why just now I got the chance to send you message again.
Anyway, here's the reply to me from GoDaddy support tech:
>>
Thank you for contacting Online Support.
By default, our Windows hosting servers display a generic error when any .NET application generates an exception. We display a generic error because the detailed error messages allow a malicious user to obtain sensitive information.

To troubleshoot the error, you can modify your web.config file and specify that a custom error message displays. A custom error message helps you to locate the specific code that is causing the issue.

CAUTION: The code samples we provide below do not constitute a complete web.config file. Do not replace your existing web.config file with the code we provide. Before changing your web.config file, we recommend creating a backup.

Displaying Custom Error Messages / Enabling Detailed Errors on IIS 7

Use the sample code below to display custom error messages on IIS 7:

<configuration>
    <system.webServer>
        <httpErrors errorMode="Detailed" />
        <asp scriptErrorSentToBrowser="true"/>
    </system.webServer>
    <system.web>
        <customErrors mode="Off"/>
        <compilation debug="true"/>
    </system.web>
</configuration>
----------------------------------------
>>
Thank you for your reply. The code samples we provide do not constitute a complete
web.config file. Do not replace your existing web.config file with the
code we provide. Before changing your web.config file, we recommend
creating a backup.A web.config file lets you customize the way your site or a specific directory on your site behaves. For example, if you place a web.config file in your root directory, it will affect your entire site (www.coolexample.com). If you place it in a /content directory, it will only affect that directory (www.coolexample.com/content). However, in order for a web.config file to register in a specific directory, there must be a web.config file in the root directory.
web.config files work on our Windows servers.

Using a web.config file, you can control:

•      Database connection strings.

•      Error behavior.

•      Security.

web.config files are XML documents. ".config" is not an extension like .html or .txt. For more information on how to set up web.config files, visit Microsoft's Web site
<<
0
 
MuffyBunnyCommented:
ok so do what they are saying and post back when you know what and where your error is coming from.
0
 
Stiebel EltronAuthor Commented:
This is what I'm receiving now:
"An error occurred on the server when processing the URL. Please contact the system administrator.
If you are the system administrator please click here to find out more about this error."

Signup site: http://www.cssasia.info/ipix/login/ste-iphoto-signup.asp
Signup result page: http://www.cssasia.info/ipix/login/signup_result.asp

Still not showing the error details of it...
0
 
MuffyBunnyCommented:
I just don't know what else to do for you without the real error. I'm shocked that godaddy wasn't more helpful. I'd fire them.
0
 
MuffyBunnyCommented:
I was kidding about the firing them thing
0
 
Stiebel EltronAuthor Commented:
Yeah, it's useless to talk with GoDaddy tech support. I think they only copy and send you what they have from their HELP (in general).
But I got an alternative way on how we can get the details of the error. I have another host, which is the brinkster host, and I got the details of the error.
Here's the error that I received from signup_result.asp
"Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/ste/login/signup_result.asp, line 12"

------------------------------------------------
Line 12 is the: "myConnection.Open connectString"
0
 
Stiebel EltronAuthor Commented:
Oooopppsssssssss!!! I'm sorry! I think that error line is because of the location of the database isn't located on the same server... Is there a way in order for us to use brinkster server, so we can have the error details of the signup_result.asp?
0
 
Stiebel EltronAuthor Commented:
Here's the latest response from GoDaddy:
"Thank you for contacting Online Support. I understand that you have questions in regards to your web.config file. These files are not placed in your account by us, unfortunately we would not be able to find where you placed these files. Normally when you use a 3rd party application these files are placed in the HTML Directory. If this file is not found you would need to create this file. Please use the guide in the previous notification to create the web.config file if needed. We thank you for your understanding in this matter and apologize for any inconvenience that it may cause."
0
 
MuffyBunnyCommented:
Now I seriously would find different hosting. Just because they don't create your web.config file doesn't mean that someone there can't look at the true error logs for their server and tell you what the real error is.

I have no idea what brinkster server is. Are you trying to run it locally? If so, fix your database connection string so you can get past that error to whatever the next error is.
0
 
Stiebel EltronAuthor Commented:
I regret choosing GoDaddy.com as our server host... as they can't give any support for this kind of error...

The reason why I'm testing it over our server is because I'm getting 500 Internal server error on our local server. I did the advises of some EE experts, but still no work.

Are u using GoDaddy.com as your server as well?
0
 
MuffyBunnyCommented:
no way. i use mochahost or hostgator. I like hostgator for non-MS environment and mochahost for an MS environment.

At any rate, you could be onto something trying to run your code locally for testing purposes. You have to get that database connection string right though or that is the error that will keep showing up. Once that fails, it doesn't even care about what may be wrong with the rest of your page.
0
 
Stiebel EltronAuthor Commented:
I'm testing it locally now, I installed the MySql 5.1 + connector.
Now the question is, how to locate the database if from the command:
connectString = "Driver={MySQL ODBC 5.1 Driver};SERVER=localhost;DATABASE=" & myDb & ";UID=steproducts;PWD=Ste2010Aeg"

The SERVER location is "localhost", what if the database is located into the another drive (for example Drive D:)? Or do I need to locate the database into the same folder of mysql? But where?

Because if you're using php, there's an appserv that take care of everything, but how about for ASP?

Kindly advise...
0
 
MuffyBunnyCommented:
classic ASP connection strings can make you swear.

Which drive you installed to should be irrelevant. Your computer should know how to resolve localhost whether it's in C or D. I don't have a lot of experience with MySQL. With my local instance of SQL 2008, I have to reference my own computer by name and then the database server by name.

Provider=SQLNCLI10;Data Source=IT380LOGI\IT380LOGI;Initial Catalog=NewCP;User ID=contactpoint;Password=cpuser;

IT380LOGI being the name of my computer and the name I gave my database server

http://www.tamilcodes.com/document.aspx?content=Snippets&id=57

Here is another one
http://p2p.wrox.com/classic-asp-databases/4180-asp-connection-mysql.html

While looking through these links, remember that you can point your local asp code to your remote godaddy mysql database. Either way, post back when you get to the error that sent us on this course in the 1st place.
0
 
Stiebel EltronAuthor Commented:
Hi there MuffyBunny!

I'm testing it locally and here's the error that I got (latest):
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[MySQL][ODBC 5.1 Driver][mysqld-5.1.40-community]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OliverDan', 'oliver@stiebeleltronasia.com', '123456', '123456', 'Stiebel', 'Eltr' at line 1

/TestLOG/signup_result.asp, line 25
------------------------------------------------------
I'm attaching my script (signup_result.asp)
and the line 25 is the: Set rsMembers = myConnection.Execute(sqlContent)

Kindly advise how to resolve this problem...

Thank you!
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%  Option Explicit             %>
<%
dim myDb, seriesid, myConnection
Dim connectString, sqlContent, rsMembers

myDb = "steproducts"

connectString = "Driver={MySQL ODBC 5.1 Driver};SERVER=localhost;DATABASE=" & myDb & ";UID=admin;PWD=stethadmin;"

Set myConnection = Server.CreateObject("ADODB.Connection")
myConnection.Open connectString

sqlContent = "INSERT INTO Members(Name, Surname, Username, Password, Email, Telephone, Mobile, Company, Address, GroupId) "  
sqlContent = sqlContent & "VALUES('" & REPLACE(request("fname"), "'", "''") & "', '" & REPLACE(request("lname"), "'", "''") & "', '"  
sqlContent = sqlContent & request("username") & ", '" & REPLACE(request("password"), "'", "''") & "', '"  
sqlContent = sqlContent & REPLACE(request("email"), "'", "''") & "', '" & REPLACE(request("telephone"), "'", "''") & "', '"  
sqlContent = sqlContent & REPLACE(request("mobile"), "'", "''") & "', '" & REPLACE(request("company"), "'", "''") & "', '"  
sqlContent = sqlContent & REPLACE(request("address"), "'", "''") & "', 3) "

Set rsMembers = Server.CreateObject("ADODB.Recordset") 
Set rsMembers = myConnection.Execute(sqlContent)
' there's no need to close the rs because it closed itself after performing an operation instead 
' of filling it with a value (a recordset)
myConnection.close
Set rsMembers = Nothing
Set myConnection = Nothing
%>
<h1 align="center">Thank You</h1>

Open in new window

0
 
Stiebel EltronAuthor Commented:
Follow up! I'm using MySql Workbench, and created a table already, here's the INSERT statement that was generated from that program:
INSERT INTO `steproducts`.`members`
(`UserID`,
`Name`,
`Surname`,
`Username`,
`Password`,
`Email`,
`Telephone`,
`Mobile`,
`Company`,
`Address`,
`GroupID`)
VALUES
(
{UserID: INT},
{Name: VARCHAR},
{Surname: VARCHAR},
{Username: VARCHAR},
{Password: VARCHAR},
{Email: VARCHAR},
{Telephone: VARCHAR},
{Mobile: VARCHAR},
{Company: VARCHAR},
{Address: VARCHAR},
{GroupID: INT}
);

But I don't know why I'm getting a red "x" on this part: {UserID: INT}, the hi-lighted part is the ":"
Please advise...
0
 
Stiebel EltronAuthor Commented:
I've tried this script:
sqlContent ="INSERT INTO someTable(intWhateverId,vchWhatever) VALUES ('"&Request.Form("intWhateverId")&"','"&Request.Form("vchWhatever")&"')"

It worked.
Then I try to apply it to my form, here's the script:
sqlContent = "INSERT INTO Memberss(UserID, Name, Surname, Username, Password, Email, Telephone, Mobile, Company, Address, GroupId)
VALUES ('"&Request.Form("fname")&"','"&Request.Form("lname")&"','"&Request.Form("username")&"','"&Request.Form("password")&"','"&Request.Form("email")&"','"&Request.Form("telephone")&"','"&Request.Form("mobile")&"','"&Request.Form("company")&"','"&Request.Form("address")&"')"

I received this error result:
Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/TestLOG/signup_result.asp, line 19

sqlContent = "INSERT INTO Memberss(UserID, Name, Surname, Username, Password, Email, Telephone, Mobile, Company, Address, GroupId)
--------------------------------------------------------------------------------
I was thinking is it because of the UserID & GroupID that wasn't present in the form that the user can see...
Because UserID & GroupID should be hidden & UserID should generate automatically_increment.

Kindly advise...
0
 
Stiebel EltronAuthor Commented:
I changed the "NAME" of the field (fname --> Name, lname --> Surname).
And I used the attached script, it's working, kindly check or advise for some corrections.

* I delete the table named: Memberss, and create a new one, which is the GrupoA.
After I delete the Memberss table, I can't create a new table with the same table name in MySql Workbench, don't know why...
sqlContent = "INSERT INTO GrupoA (Name,Surname,Username,Password,Email,Telephone,Mobile,Company,Address) VALUES ('"&Request.Form("Name")&"','"&Request.Form("Surname")&"','"&Request.Form("Username")&"','"&Request.Form("Password")&"','"&Request.Form("Email")&"','"&Request.Form("Telephone")&"','"&Request.Form("Mobile")&"','"&Request.Form("Company")&"','"&Request.Form("Address")&"')"

Open in new window

0
 
MuffyBunnyCommented:
1st piece of advice.. don't use Name as the name of anything in a database. Name is a keyword, which means you will then have to  put [ ]'s around it everytime you're trying to reference your field vs the keyword.

2nd piece of advice... this question has gone from one thing to another to another to another. All in 1 500 point question we've covered connection strings, sql syntax, ADO connections, ASP fundamentals and now we're going to delve into MySQL????

Off-topic comments removed.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.