Forums
This topic is locked
Dreamweaver ASP to MYSQL updating
Posted 13 Apr 2004 21:16:42
1
has voted
13 Apr 2004 21:16:42 Christian Essex posted:
Greetings!I'm creating a Shockwave mmorpg which uses ASP pages created in Dreamweaver to communicate with MYSQL.
I'm a bit of a Dreamweaver/ASP newb, but here's what I've got working so far:
-ASP insert page for new player registration which checks for duplicate usernames, forwards correctly, and writes to MYSQL correctly.
-ASP login page which correctly pulls data from MYSQL according to username/password provided and forwards correctly, thus showing results.
When a player logins in, their player info is correctly loading into my shockwave file. All is great.
What I'm wondering is how to change fields in the MYSQL DB. What's the theory behind this? How does it work?
Obviously, one of the variables imported upon login is the userID, which is the MYSQL primary field. How do I reference this so that only a specific field in a player specific row in the MYSQL table is updated?
Thanks!
Replies
Replied 13 Apr 2004 22:56:45
13 Apr 2004 22:56:45 Vince Baker replied:
there is a function in dreamweaver that allows you to run an update sql command.
Basically you specify the row to update with the unique id (your userid field) and then state which fields are to be updated with what values.
If you are not using a form to submit this info, her is a snippet of code that you can use to run the update command.
Just change field names and variables etc to what you want:
<%
Dim Update1
Dim strSQL
strSQL = "UPDATE Table_Name set Field1='" & string1 & "', Field2='" & string2 & "', Field3='" & string3 & "' where ID=" & stringID
%>
<%
set Update1 = Server.CreateObject("ADODB.Connection"
Update1.ConnectionString = MM_CONN_NAME_STRING
Update1.Open
Update1.Execute strSQL
Update1.Close
Set Update1 = Nothing
%>
You with either need to paste the include part for your connection file or specify the connection literally.
Let me know if you have any questions.
Regards
Vince
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting
Basically you specify the row to update with the unique id (your userid field) and then state which fields are to be updated with what values.
If you are not using a form to submit this info, her is a snippet of code that you can use to run the update command.
Just change field names and variables etc to what you want:
<%
Dim Update1
Dim strSQL
strSQL = "UPDATE Table_Name set Field1='" & string1 & "', Field2='" & string2 & "', Field3='" & string3 & "' where ID=" & stringID
%>
<%
set Update1 = Server.CreateObject("ADODB.Connection"
Update1.ConnectionString = MM_CONN_NAME_STRING
Update1.Open
Update1.Execute strSQL
Update1.Close
Set Update1 = Nothing
%>
You with either need to paste the include part for your connection file or specify the connection literally.
Let me know if you have any questions.
Regards
Vince
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 13 Apr 2004 23:02:30
13 Apr 2004 23:02:30 Christian Essex replied:
I will indeed be using a form (as I'm somewhat familiar with how they work) and it seems a great way to debug.
The actual asp pages will never be 'seen' as this is all handled in shockwave.
Anyway, any more input on going the form route would be most appreciated (such as, Dreamweaver menu command, etc.)
As far as the userID goes, I imagine I fill in that in the form by pulling the variable from the current string?
And from looking at your code it seems like the rest should fall into place...
The actual asp pages will never be 'seen' as this is all handled in shockwave.
Anyway, any more input on going the form route would be most appreciated (such as, Dreamweaver menu command, etc.)
As far as the userID goes, I imagine I fill in that in the form by pulling the variable from the current string?
And from looking at your code it seems like the rest should fall into place...
Replied 13 Apr 2004 23:12:12
13 Apr 2004 23:12:12 Vince Baker replied:
If you are using a form then under the server behaviours tab you will be able to click on the add symbol and you will see the update record option....
This opens a wizard based screen that will allow you to select table to update, fields form elements to populate fields etc...
As you say, your userid will identify your row.
Regards
Vince
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting
This opens a wizard based screen that will allow you to select table to update, fields form elements to populate fields etc...
As you say, your userid will identify your row.
Regards
Vince
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting