Raised This Month: $ Target: $400
 0% 

How to get list from MySql


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
reinert
Veteran Member
Join Date: Feb 2007
Old 09-21-2011 , 03:49   How to get list from MySql
Reply With Quote #1

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")


Last edited by reinert; 09-21-2011 at 04:17.
reinert is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 09-21-2011 , 09:19   Re: How to get list from MySql
Reply With Quote #2

szTemp Never executed?
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
reinert
Veteran Member
Join Date: Feb 2007
Old 09-21-2011 , 12:31   Re: How to get list from MySql
Reply With Quote #3

What u mean ? So how should it look like ? and how to use SQL_NextRow ?
reinert is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 09-21-2011 , 13:16   Re: How to get list from MySql
Reply With Quote #4

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?
jimaway is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 09-21-2011 , 13:36   Re: How to get list from MySql
Reply With Quote #5

Well I'm not sure how to do it. So I did it randomly as I though it should be

So could someone help me to fix it ?
reinert is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 09-21-2011 , 13:40   Re: How to get list from MySql
Reply With Quote #6

maby you should read this tutorial: http://forums.alliedmods.net/showthread.php?t=46779
jimaway is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 09-21-2011 , 13:51   Re: How to get list from MySql
Reply With Quote #7

Yeah I've been using SQL in simple situations, but never had to do it with TOP list or smth.
reinert is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 09-21-2011 , 14:08   Re: How to get list from MySql
Reply With Quote #8

http://forums.alliedmods.net/showthr...77#post1332477
__________________
Impossible is Nothing
Sylwester is offline
Reply


Thread Tools
Display Modes

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 19:41.


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