Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
Merging UserID with ID
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Sledmore" data-source="post: 385359" data-attributes="member: 591"><p>I'm not 100% sure I follow?</p><p></p><p>I think I know what you want, but that'd be on inserting the data? You can have defaults in the database or just insert in full via your code.</p><p></p><p>[PHP]</p><p> public void InsertCharacter(Character Character)</p><p> {</p><p> //Check if it already exists</p><p> if (!this._character.ContainsKey(Character.Id))</p><p> return;</p><p></p><p> //Run our query, possibly run a check before this to check the database.</p><p> using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())</p><p> {</p><p> dbClient.SetQuery("INSERT INTO `userminigame_stats` (`id`,`hp`,`kills`,`deaths`) VALUES ('" + Character.Id + "', '" + Character.HP + "', '" + Character.Kills + "', '" + Character.Deaths + "')");</p><p> //I've done SetQuery so you can prepare the statement, it's most likely not needed as the data is already validated, I was just too lazy to do the rest.</p><p> dbClient.RunQuery();</p><p> }</p><p> }</p><p>[/PHP]</p><p></p><p>That would go in your manager. I hope this is right? Let me know.</p></blockquote><p></p>
[QUOTE="Sledmore, post: 385359, member: 591"] I'm not 100% sure I follow? I think I know what you want, but that'd be on inserting the data? You can have defaults in the database or just insert in full via your code. [PHP] public void InsertCharacter(Character Character) { //Check if it already exists if (!this._character.ContainsKey(Character.Id)) return; //Run our query, possibly run a check before this to check the database. using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("INSERT INTO `userminigame_stats` (`id`,`hp`,`kills`,`deaths`) VALUES ('" + Character.Id + "', '" + Character.HP + "', '" + Character.Kills + "', '" + Character.Deaths + "')"); //I've done SetQuery so you can prepare the statement, it's most likely not needed as the data is already validated, I was just too lazy to do the rest. dbClient.RunQuery(); } } [/PHP] That would go in your manager. I hope this is right? Let me know. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Merging UserID with ID
Top