iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Database Discussion Forum This is the place to find help resolving those nagging questions you have about implementing and using all kinds of databases. Need help writing a query? Need an opinion on Oracle? Post here!

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-16-2004, 06:45 PM
WebProWorld New Member
 
Join Date: Oct 2004
Location: UK
Posts: 3
PhillipH RepRank 0
Default ASP & Mysql Speed

Hello

one of my games ive coded at http://www.gatesofatlantis.com uses the following asp code to query a mysql database and then print each line to the screen - rankings page (both asp page and mysql server on the same computer) :

Code:
strconn="DRIVER={MySQL ODBC 3.51 Driver};Server=servername;Database=databasename;Uid=username;Pwd=passwordname"
Set CONN = Server.CreateObject("ADODB.Connection")
CONN.Open strconn

myquery = "SELECT * FROM tablename ORDER by score DESC"
set query=Conn.execute(myquery)
do while not query.eof

ccharactername=query("charactername")
ckingdom=query("kingdomname")
crace=query("racename")
cscore=query("scorename")
cacres=query("maxacresname")
cworship=query("worshipname")
i=i+1
	
response.write ("<tr><td class='x'>" & i & "</td><td class='x'>" & ccharactername & "</td><td class='x'>" & ckingdom & "</td><td class='x'>" & crace & "</td><td class='x'>" & cworship & "</td><td class='x'>" & cscore & "</td></tr>")

set conn = nothing
query.movenext
loop
My question is about optimisation, although its not real slow it could be alot quicker, especially as ingame it has to read 1 record from a database on every page (as the values in the database change constantly). The code for reading 1 record from the database is :

Code:
strconn="DRIVER={MySQL ODBC 3.51 Driver};Server=servername;Database=datbasename;Uid=username;pwd=passwordname"
Set CONN = Server.CreateObject("ADODB.Connection")
CONN.Open strconn

myquery = "SELECT * FROM tablename WHERE password = '" & passwordname & "'"
set query=Conn.execute(myquery)

charactername=query("charactername")
kingdom=query("kingdomname")
password=query("passwordname")
email=query("emailname")
race=query("racename")
endurance=query("endurancename")

'it reads in about 200 field names into variables.

set conn = nothing
now as you can appreciate doing this to read 1 record on every page (or turn taken on the game) wont be fast.

can anyone optimise this or give me tips on how to optimise the above ?

thanks.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 11:57 PM.



Search Engine Optimization by vBSEO 3.3.0