Click here to Skip to main content
16,010,512 members
Home / Discussions / Web Development
   

Web Development

 
AnswerRe: How to get response after posting form data Pin
brianwelsch31-Aug-03 3:38
brianwelsch31-Aug-03 3:38 
GeneralRe: How to get response after posting form data Pin
haritadala1-Sep-03 3:51
haritadala1-Sep-03 3:51 
GeneralRe: How to get response after posting form data Pin
brianwelsch2-Sep-03 13:57
brianwelsch2-Sep-03 13:57 
Generalcreate a pdf document with ASP Pin
Jerome Conus26-Aug-03 19:56
Jerome Conus26-Aug-03 19:56 
GeneralRe: create a pdf document with ASP Pin
Vasudevan Deepak Kumar2-Sep-03 18:46
Vasudevan Deepak Kumar2-Sep-03 18:46 
GeneralCompletely Confused Pin
RB@Emphasys26-Aug-03 16:41
RB@Emphasys26-Aug-03 16:41 
GeneralHelp! Pin
lnong26-Aug-03 9:55
lnong26-Aug-03 9:55 
GeneralASP: Connection problem (MySQL) Pin
knoppen26-Aug-03 3:48
knoppen26-Aug-03 3:48 
Hello. My problem is that I wrote a session handling-script from a book I bought, but the code they have connects to a MS Access database. I can't use Access databases at my webhotel so I tried to rewrite it to connect to MySQL instead. It doesn't work for me.

The MS Access version connects via a file called Global.asa and via ODBC. The Global.asa file looks like this:

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
SUB Application_OnStart
Application.Lock
Application("Conn") = "driver={SQL Server};SERVER=localhost;UID=login;PWD=password;Database=database"
Application.UnLock
END SUB
</SCRIPT>

(The SQL Server code I've added myself, it's supposed to be the same type of connectioncode there but for Access)

And this is how my connection strings in the documents looks like:

Login:

<%
un = Request.Querystring("un")
pw = Request.Querystring("pw")
If (Len(un) > 0) And (Len(pw) > 0) Then
Set Cmd = Server.CreateObject("ADODB.Command")
Cmd.ActiveConnection = Application("Conn")
ssql = "SELECT id FROM cmy_se WHERE un = '" & un & "'"
ssql = ssql & " AND pw = '" & pw & "'"
Cmd.CommandText = ssql
Cmd.CommandType = adCmdText
SET Rs = Cmd.Execute
if NOT Rs.EOF Then
Session("userid") = Rs("id")
%>


Newmember:

<%
email = Request.Form("email")
un = Request.Form("un")
pw = Request.Form("pw")
If (Len(email) > 0) AND (Len(un) > 0) AND (Len(pw) > 0) Then
Set Cmd = Server.CreateObject("ADODB.Command")
Cmd.ActiveConnection = Application("Conn")
ssql = "SELECT * FROM cmy_se WHERE un = '" & un & "'"
ssql = ssql & " AND pw = '" & pw & "'"
Cmd.CommandText = ssql
Cmd.CommandType = adCmdText
Set Rs = Cmd.Execute
If Rs.EOF Then
SQLStmt = "INSERT INTO cmy_se"
SQLStmt = SQLStmt & "(email,un,pw)"
SQLStmt = SQLStmt & "VALUES(?,?,?)"
Cmd.CommandText = SQLStmt
Cmd.CommandType = adCmdText
Set prm = Cmd.CreateParameter (,adVarChar,,Len(email),email)
Cmd.Parameters.Append prm
Set prm = Cmd.CreateParameter (,adVarChar,,Len(un),un)
Cmd.Parameters.Append prm
Set prm = Cmd.CreateParameter (,adVarChar,,Len(pw),pw)
Cmd.Parameters.Append prm
Cmd.Execute
ssql = "SELECT id FROM cmy_se WHERE un = '" & un & "'"
ssql = ssql & " AND pw = '" & pw & "'"
Cmd.CommandText = ssql
Cmd.CommandType = adCmdText
Set Rs = Cmd.Execute
If Not Rs.EOF Then
Session("userid") = Rs("id")
%>

What changes must I make to get it to work with my MySQL database?

Might I add I can't use ODBC or DSN, I have to use a direct connection.

Thank you.

Yeah..
GeneralRe: ASP: Connection problem (MySQL) Pin
MKlucher28-Aug-03 17:54
MKlucher28-Aug-03 17:54 
GeneralRe: ASP: Connection problem (MySQL) Pin
Diederik de Haas5-Sep-03 5:00
Diederik de Haas5-Sep-03 5:00 
GeneralLayout question Pin
Tomas Petricek26-Aug-03 0:35
Tomas Petricek26-Aug-03 0:35 
GeneralRe: Layout question Pin
Paul Watson26-Aug-03 1:10
sitebuilderPaul Watson26-Aug-03 1:10 
GeneralRe: Layout question Pin
Tomas Petricek26-Aug-03 1:22
Tomas Petricek26-Aug-03 1:22 
GeneralRe: Layout question Pin
Paul Watson26-Aug-03 2:15
sitebuilderPaul Watson26-Aug-03 2:15 
GeneralRe: Layout question Pin
Tomas Petricek26-Aug-03 2:27
Tomas Petricek26-Aug-03 2:27 
GeneralRe: Layout question Pin
ZoogieZork26-Aug-03 2:05
ZoogieZork26-Aug-03 2:05 
GeneralRe: Layout question Pin
Paul Watson26-Aug-03 6:46
sitebuilderPaul Watson26-Aug-03 6:46 
Generaltab or indent Pin
pnpfriend25-Aug-03 10:33
pnpfriend25-Aug-03 10:33 
GeneralRe: tab or indent Pin
Anonymous26-Aug-03 4:46
Anonymous26-Aug-03 4:46 
GeneralRe: tab or indent Pin
pnpfriend27-Aug-03 3:55
pnpfriend27-Aug-03 3:55 
GeneralBrowser shortcut to an exe Pin
3green25-Aug-03 5:27
3green25-Aug-03 5:27 
GeneralCall ASP function in VBSCRIPT Pin
Daron Tan25-Aug-03 2:39
Daron Tan25-Aug-03 2:39 
GeneralRe: Call ASP function in VBSCRIPT Pin
Hesham Amin25-Aug-03 4:05
Hesham Amin25-Aug-03 4:05 
Generaljava Word maker help required Pin
seunao25-Aug-03 1:43
seunao25-Aug-03 1:43 
GeneralRe: java Word maker help required Pin
ZoogieZork25-Aug-03 4:27
ZoogieZork25-Aug-03 4:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.