The online racing simulator
a little SQL help?
recently I'm coding my insim into MYSQL database and I downloaded this source

when I tried to add this query tables

<?php 
Query
("CREATE TABLE IF NOT EXISTS lfsusers(id INT NOT NULL AUTO_INCREMENT,PRIMARY KEY(id),username char(23) NOT NULL,cars char(84) NOT NULL,cash INT NOT NULL,bbal INT NOT NULL,gold INT NOT NULL,distance INT NOT NULL,lastlotto TINYINT NOT NULL,joindate INT NOT NULL,health TINYINT NOT NULL,jobsdone INT NOT NULL,goods1 TINYINT NOT NULL,goods2 TINYINT NOT NULL,Member TINYINT NOT NULL,Officer TINYINT NOT NULL,Cadet TINYINT NOT NULL,TowTruck TINYINT NOT NULL,Interface TINYINT NOT NULL,Speedo TINYINT NOT NULL,Odometer TINYINT NOT NULL,Panels TINYINT NOT NULL,Renting TINYINT NOT NULL,Rented char(30) NOT NULL,Renterer char(30) NOT NULL,Rentering TINYINT NOT NULL);");
                
?>

I got errors when closing or updating the database


<?php 
        
public void UpdateUser(clsConnection u)
        {
            try
            {
                if (
u.Username == "")
                    return;
                
string query "UPDATE lfsusers SET ";
                foreach (
FieldInfo mi in typeof(clsConnection).GetFields())
                {
                    foreach (
StatsAttribute a in mi.GetCustomAttributes(typeof(StatsAttribute), false))
                    {
                        if ((
a.Name != "username" && a.Name != "joindate"))
                            
query += a.Name "='" Escape(mi.GetValue(u).ToString()) + "', ";
                    }
                }
                
query query.Substring(0query.Length 2);
                
query += " WHERE username='" Escape(u.Username) + "';";
                
Query(query);
            }
            catch (
Exception EX) { globalVoids.ErrorLog("UpdateUsers - " EX.Message); }
        }
?>

Exception Errors
[6/19/2011 8:52:25 AM] : UpdateUsers - Object reference not set to an instance of an object.

any help guys ?
debug it

console.write (query)

and search for errors
This is C# error, not SQL, some variable is probably null.
Add StackTrace and see in what line error occurs.
catch (Exception EX) { globalVoids.ErrorLog("UpdateUsers - " + EX.Message +"\n\n"+EX.StackTrace); }


FGED GREDG RDFGDR GSFDG