SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 27/05/2012, 08:14 PM   #1
starmaster014
Little Clucker
 
Join Date: May 2012
Posts: 1
Reputation: 0
Default MySQL returns wrong field?!

Hey guys, i got a problem with MySQL.

I have a stock which returns the password of a user and that works fine:
Code:
stock mysql_ReturnPasswort(Name[])
{
    new query[130], Get[130];
    mysql_real_escape_string(Name, Name);
    format(query, 128, "SELECT `passwort` FROM `accounts` WHERE `Name` = '%s'", Name);
    mysql_query(query);
    mysql_store_result();
    mysql_fetch_row(Get);
    mysql_free_result();
    return Get;
}
But my problem is the stock which should return an Integer of a Field:

Code:
stock mysql_GetInt(Table[], Field[], Where[], Is[])
{
	new sqlint;
    new query[128];
    mysql_real_escape_string(Table, Table);
    mysql_real_escape_string(Field, Field);
    mysql_real_escape_string(Where, Where);
    mysql_real_escape_string(Is, Is);
    format(query, 128, "SELECT `%s` FROM `%s` WHERE `%s` = '%s'", Field, Table, Where, Is);
    mysql_query(query);
    mysql_store_result();
    sqlint = mysql_fetch_int(connection);
    mysql_free_result();
    return sqlint;
}
It gets called like this when a user login (for debugging):

printf("%s",mysql_GetInt("accounts", "Money", "Name", PlayerName(playerid)));

But in the log it just says "sqltest1" (thats a part from the password of the user, the full pw is "mysqltest1")

Why does it return a part of the password and not the integer from the right field?
Can someone help me? I use the mysql plugin by Strickenkid

greetz!

Last edited by starmaster014; 27/05/2012 at 08:48 PM.
starmaster014 is offline   Reply With Quote
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Loading HEX from a MySQL field Luis- Scripting Help 13 15/04/2012 10:45 PM
how to get max field in mysql System64 Scripting Help 3 05/01/2012 06:58 PM
mysql field deleting! armyoftwo Help Archive 2 08/08/2010 08:56 AM
Reading a variable from MySQL field Antonio [G-RP] Help Archive 4 23/06/2010 05:22 PM
MySQL get a field in string _GriLLeX_ Help Archive 0 30/11/2009 07:45 PM


All times are GMT. The time now is 10:20 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.