recently I'm coding my insim into MYSQL database and I downloaded this source
when I tried to add this query tables
I got errors when closing or updating the database
Exception Errors
any help guys ?
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);");
?>
<?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(0, query.Length - 2);
query += " WHERE username='" + Escape(u.Username) + "';";
Query(query);
}
catch (Exception EX) { globalVoids.ErrorLog("UpdateUsers - " + EX.Message); }
}
?>
[6/19/2011 8:52:25 AM] : UpdateUsers - Object reference not set to an instance of an object.
any help guys ?