Game Development Community

Problems with MySQL/Torque

by Erik Madison · in Torque Game Engine · 11/28/2002 (2:44 pm) · 3 replies

I followed the resource from Future Interactive, but I am having a hard time. The following is my version of the script, along with the results of my echoes. Does anyone see any obvious errors?

%mysqltest.Connect();
echo("Connected, now trying a query...");
%mysqltest.Query ("SELECT * FROM stats");

%result= %mysqltest.StoreResult();
echo("Entering NumRows loop, attempting to break info down");
echo("Numrows found: " @ %mysqltest.NumRows(%result)); // returns 2, which is correct

for (%i= 0; %i < %mysqltest.NumRows(%result); %i++)
{ // I have two rows, both exactly the same
echo("Looping begun: " @ %result);
// returns -2147483647, which looks suspect,
// but the next few lines all return proper,
// so perhaps its okay
if (%mysqltest.FetchRow (%result))
echo ("Fetchrow was successful.");
echo("Numfields in this row: " @ %mysqltest.NumFields());
// returns 6, which is correct

// Heres the trouble. Uncomment any of the following
// and I will crash with a memory error
// %strstat= %mysqltest.GetRowCell (%result, "Str");
// %intstat= %mysqltest.GetRowCell (%result, "Int");
// %wisstat= %mysqltest.GetRowCell (%result, "Wis");
// %dexstat= %mysqltest.GetRowCell (%result, "Dex");
// %constat= %mysqltest.GetRowCell (%result, "Con");
// %chastat= %mysqltest.GetRowCell (%result, "Cha");

echo ("");
echo ("--------------------------------------------------");
echo ("Str: " @ %strstat @ " Int: " @ %intstat @ " Wis: " @ %wisstat);
echo ("--------------------------------------------------"); // etc, etc.
echo ("");
}

#1
11/28/2002 (4:35 pm)
try it out with just a web page first before popping it into torque, there are also a few syntax editors online, try one of those out. If you still don't have any luck ill give it a try when i get back to my workstation next week.
#2
02/14/2003 (4:45 am)
Hello,

I'm new to Torque, but going to start to work with.
I would like to know what kind of databases I can use with my future game for storying game data.
Is there any kind of internal db, so the player doesnt need to install any dbe on his computer?

Does Torque contain MySQL run-time in its libraries for independent work?

Thank you!
#3
02/14/2003 (7:11 am)
the mysql stuff is 3rd party (free) resource, you'll have to add it to TGE yourself.