Raised This Month: $ Target: $400
 0% 

Question about MySql


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Author Message
Kiske
Veteran Member
Join Date: May 2009
Old 05-29-2010 , 18:08   Question about MySql
#1

How I can detect between a query if the date is repited in another "column" of the data base?

Example:
Quote:
Nick -- Money
Kiske 16000
Nanna 16000
Pipu 14389
Lole 10890

Kiske and Nanna have U$S 16000

__________________

Kiske is offline
Send a message via Skype™ to Kiske
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 05-29-2010 , 18:21   Re: Question about MySql
#2

Maybe you find something useful here.I think "distinct" should be the solution or w/e (this is in case you want to select only entryes that have the distinct 'money' value')
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 05-29-2010 at 18:24.
Alka is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 05-29-2010 , 18:27   Re: Question about MySql
#3

Try this:
PHP Code:
public get_money(id){
    static 
cache[256], data[2]
    new 
money 16000
    formatex
(cache255,"SELECT Nick FROM table_name WHERE Money=%d;"money)
    
data[0] = money
    SQL_ThreadQuery
(g_SqlTuple"handle_get_money_query"cachedata1)
    return 
PLUGIN_HANDLED
}


public 
handle_get_money_query(FailState,Handle:Query,Error[],Errcode,Data[],DataSize){
    static 
name[32], money
    
if(FailState){
        
log_amx("SQL Error: %s (%d)"ErrorErrcode)
        return 
PLUGIN_HANDLED
    
}

    
money Data[0]
    while(
SQL_MoreResults(Query)){
        
SQL_ReadResult(Query,SQL_FieldNameToNum(Query,"Nick"), name31)
        
client_print(0print_chat"%s has %d money"namemoney)
        
SQL_NextRow(Query)
    }
    return 
PLUGIN_CONTINUE

__________________
Impossible is Nothing
Sylwester is offline
Kiske
Veteran Member
Join Date: May 2009
Old 05-29-2010 , 18:34   Re: Question about MySql
#4

Quote:
Originally Posted by Sylwester View Post
Try this:
PHP Code:
public get_money(id){
    static 
cache[256], data[2]
    new 
money 16000
    formatex
(cache255,"SELECT Nick FROM table_name WHERE Money=%d;"money)
    
data[0] = money
    SQL_ThreadQuery
(g_SqlTuple"handle_get_money_query"cachedata1)
    return 
PLUGIN_HANDLED
}


public 
handle_get_money_query(FailState,Handle:Query,Error[],Errcode,Data[],DataSize){
    static 
name[32], money
    
if(FailState){
        
log_amx("SQL Error: %s (%d)"ErrorErrcode)
        return 
PLUGIN_HANDLED
    
}

    
money Data[0]
    while(
SQL_MoreResults(Query)){
        
SQL_ReadResult(Query,SQL_FieldNameToNum(Query,"Nick"), name31)
        
client_print(0print_chat"%s has %d money"namemoney)
        
SQL_NextRow(Query)
    }
    return 
PLUGIN_CONTINUE

No, sorry, but that's not what I want.
I want to query for PhpMyAdmin and I show it from there, not from a plugin, sorry.

And sorry but I am very bad at English


I do not want the query:
SELECT * FROM money WHERE `date` = '16000'

For the 16000 was an example, I want to show me their recurrence.
__________________

Kiske is offline
Send a message via Skype™ to Kiske
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 05-29-2010 , 18:29   Re: Question about MySql
#5

He want to detect if in the column 'Money', there are 2 or more entryes with the same value...
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Brreaker
Senior Member
Join Date: Oct 2009
Location: Constanta, Romania
Old 05-30-2010 , 02:25   Re: Question about MySql
#6

Well, here you will find only scripting help.If you want some website, not the right place...
__________________
There are 10 kinds of people.Those who understand binary, and those who don't.
Also, for those who understand binary, there is a donation tab too!
No steam || PM support!
Brreaker is offline
Send a message via MSN to Brreaker Send a message via Yahoo to Brreaker
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-31-2010 , 03:35   Re: Question about MySql
#7

This has nothing to do with AMXX scripting.
MySQL is it's own queries and isn't dependent on AMXX.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Closed Thread


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 05:28.


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