AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to get list from MySql (https://forums.alliedmods.net/showthread.php?t=167854)

reinert 09-21-2011 03:49

How to get list from MySql
 
Hey, how to get list of players and other column from mysql ?

I want to get a list like that:

Name----SomeNum
Name2--SomeNum2
...

Then show it on Motd, like top :)

PS. Also how to get the numrow in sql table ? like in php
PHP Code:

mysql_num_rows($result); 

Is this the same ? http://www.amxmodx.org/funcwiki.php?go=func&id=1107

Whats wrong with that ? :

PHP Code:

public PrintCountMotd(id)
{
    new 
Motd[1256], szTemp[512];
    new 
iLen[555];
    new 
rowNum SQL_AffectedRows g_SqlTuple )
    new 
szName[33], iResult[33]
    for(new 
0rowNumi++)
    {
        
get_user_name(iszName32)
        
format(szTemp,charsmax(szTemp),"SELECT count FROM `count` WHERE name='%s'"szName)
        
iResult SQL_ReadResult(Query0)
        
        
iLen += formatex(Motd[iLen], charsmax(Motd) - iLen"%s - %d^n"szNameiResult)
    }
    
show_motd(idiLen"Admin count")



lucas_7_94 09-21-2011 09:19

Re: How to get list from MySql
 
szTemp Never executed?

reinert 09-21-2011 12:31

Re: How to get list from MySql
 
What u mean ? So how should it look like ? and how to use SQL_NextRow ?

jimaway 09-21-2011 13:16

Re: How to get list from MySql
 
PHP Code:

iLen += formatex(Motd[iLen], charsmax(Motd) - iLen"%s - %d^n"szNameiResult)
    }
    
show_motd(idiLen"Admin count"

lol, that code is so messed up
proper question would be: Whats not wrong with that? :mrgreen:

reinert 09-21-2011 13:36

Re: How to get list from MySql
 
Well I'm not sure how to do it. So I did it randomly as I though it should be :D

So could someone help me to fix it ? :)

jimaway 09-21-2011 13:40

Re: How to get list from MySql
 
maby you should read this tutorial: http://forums.alliedmods.net/showthread.php?t=46779
:D

reinert 09-21-2011 13:51

Re: How to get list from MySql
 
Yeah I've been using SQL in simple situations, but never had to do it with TOP list or smth.

Sylwester 09-21-2011 14:08

Re: How to get list from MySql
 
http://forums.alliedmods.net/showthr...77#post1332477


All times are GMT -4. The time now is 19:41.

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