Help (MySQL)...
#8

Here is table structure representation:
PHP код:
Items
    ID 
INTEGER PRIMARY_KEY
    Type 
INTEGER
    UID 
INTEGER FOREIGN KEY
Users
    ID 
INTEGER PRIMARY_KEY    
    
... 
So to count all items owned by a user:
PHP код:
SELECT `TypeFROM `ItemsWHERE `UID` = <user_id
Code:
PHP код:
OnLoad()
{
    for (new 
icache_get_rows_count(); ji++)
    {
        
// do stuff
    
}

If you have a max item limit, say #define MAX_ITEMS (10), the for loop will be:
PHP код:
OnLoad()
{
    new 
limit cache_get_rows_count();
    if (
limit MAX_ITEMS
        
limit MAX_ITEMS;
    for (new 
ilimit i++)
    {
        
// do stuff
    
}

You can use Username instead of UID in case you want string matching. But i recommend UID.
Reply


Messages In This Thread
Help (MySQL)... - by Unrea1 - 04.10.2016, 22:39
Re: Help (MySQL)... - by PrO.GameR - 04.10.2016, 23:31
Re: Help (MySQL)... - by Unrea1 - 04.10.2016, 23:39
Re: Help (MySQL)... - by Vince - 05.10.2016, 05:23
Respuesta: Re: Help (MySQL)... - by Unrea1 - 23.10.2016, 21:57
Respuesta: Help (MySQL)... - by Unrea1 - 24.10.2016, 16:55
Respuesta: Help (MySQL)... - by Unrea1 - 26.10.2016, 19:34
Re: Help (MySQL)... - by Gammix - 26.10.2016, 20:02

Forum Jump:


Users browsing this thread: 1 Guest(s)