ID:138987
 
Code:
mob/verb
BanCheck()
var/DBConnection/dbcon = new()
usr<< "Making Connection"
dbcon.Connect(GDBI,GUSR,GPSS)
usr<< "Checking Connection"
if(!dbcon.IsConnected()) usr << dbcon.ErrorMsg()
else usr<< "Connection Made"
var/DBQuery/BanCheck = new("SELECT `BanType` FROM `Bans` WHERE `Key` = '[src.key]' OR `IP` = '[src.client.address]' OR `Computer_ID` = '[src.client.computer_id]'")
if(BanCheck.Execute())
usr << "Connected to server"
//The rest would go here.. but..


Problem description:
Alright, let me explain. I've been trying to make it so that the Ban system I have retrieves a table from a Database, and such. The GDBI, GUSR, and GPSS are already set variables, being the dbi, user, and password respectively. After afew hours of having trouble with this code, I started inputting the checks. The Verb is meant to be a proc, but I made it a verb for testing.

This is what outputs when I use the verb.

runtime error: Cannot read null._db_con
proc name: Execute (/DBQuery/proc/Execute)
source file: core.dm,93
usr: RageFury33 (/mob)
src: /DBQuery (/DBQuery)
call stack:
/DBQuery (/DBQuery): Execute("SELECT `BanType` FROM `Bans` ...", null)
RageFury33 (/mob): BanCheck()

Making Connection
Checking Connection
The specified module could not be found.


Can anyone help? I assume it has something to do with how I formatted this, or I may be missing something. I already have the Database, and the table made, along with all the Columns.
Thanks in advance!
Is this on a windows computer?
You'll need a copy of libmysql.dll inside Windows/system32 if you're on a 32-bit flavour of Windows, or Windows/SysWOW64 if you're on 64-bit.

If linux, you need to install mysql-client.
In response to Murrawhip
I'm connecting to a seperate MySQL database.. and I realized my problem. Though, it just spawned a new problem.


I'll try to fix it, and come back if I still have the problem.