Raised This Month: $51 Target: $400
 12% 

[CS:GO] Get Random Row from Database


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SkinnyBruv
AlliedModders Donor
Join Date: Feb 2013
Location: Straya
Old 03-13-2016 , 23:20   [CS:GO] Get Random Row from Database
Reply With Quote #1

Howdy Guys,

Just wondering how you get a random row from a database

For Example:
"SELECT random column FROM tableName;
Then do this function with the 3 values that come from that Column

Cheers

If you need any more information just chuck us a reply or add on steam for InRealTime talk
Steam: SkinnyBruv #Scum
__________________
www.ancientgaming.net is my story.
Everything happens for a reason.
Nothing is random...
#Do you even AGN...
SkinnyBruv is offline
Send a message via Skype™ to SkinnyBruv
Kailo
Senior Member
Join Date: Sep 2014
Location: Moscow, Russia
Old 03-14-2016 , 01:28   Re: [CS:GO] Get Random Row from Database
Reply With Quote #2

em, this not sourcemod question, is't SQL. And if use google http://stackoverflow.com/questions/1...dom-row-in-sql
For MySQL:
Quote:
SELECT column FROM table
ORDER BY RAND()
LIMIT 1

Last edited by Kailo; 03-14-2016 at 01:29.
Kailo is offline
SkinnyBruv
AlliedModders Donor
Join Date: Feb 2013
Location: Straya
Old 03-14-2016 , 02:12   Re: [CS:GO] Get Random Row from Database
Reply With Quote #3

You must have mistaken me, im trying to do this with Sourcemod

I know how to do it with MYSql, but how do you choose a random table from MySQL using sourcemod, and then use this table to create like a spawn with it...
__________________
www.ancientgaming.net is my story.
Everything happens for a reason.
Nothing is random...
#Do you even AGN...
SkinnyBruv is offline
Send a message via Skype™ to SkinnyBruv
Darkness_
Veteran Member
Join Date: Nov 2014
Old 03-14-2016 , 02:15   Re: [CS:GO] Get Random Row from Database
Reply With Quote #4

Quote:
Originally Posted by SkinnyBruv View Post
Just wondering how you get a random row from a database
Quote:
Originally Posted by SkinnyBruv View Post
but how do you choose a random table
Well, which one is it?
Darkness_ is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 03-14-2016 , 05:01   Re: [CS:GO] Get Random Row from Database
Reply With Quote #5

Quote:
Originally Posted by Kailo View Post
em, this not sourcemod question, is't SQL. And if use google http://stackoverflow.com/questions/1...dom-row-in-sql
For MySQL:
Code:
SELECT column FROM table
ORDER BY RAND()
LIMIT 1
Now you're so smart to suggest Google, have you considered using Google yourself, to find out if "ORDER BY RAND()" could be a bad idea?

If you have a large database, such as player tracking (or store) databases, don't use "ORDER BY RAND()".
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:42.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode