new to SQL - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: new to SQL (
/showthread.php?tid=210727)
new to SQL -
armyoftwo - 13.01.2011
I'm experienced with MySQL, but its the first time i am working with SQL.
pawn Код:
stock GetAchievementDescription(Achievement[])
{
new query[128];
format(query,128,"SELECT Description FROM Achievements WHERE FullName = '%s'",Achievement);
JA_Result=db_query(JA_Database,query);
db_get_field(JA_Result,0,query,128);
db_free_result(JA_Result);
return query;
}
This code returns the query, but not the fetched data from the field.
Re: new to SQL -
pen_theGun - 13.01.2011
https://sampwiki.blast.hk/wiki/Db_get_field_assoc
Re: new to SQL -
DVDK - 13.01.2011
I suggest loading this only once, and saving it into a variable, instead of always load it when need to.
Re: new to SQL -
armyoftwo - 14.01.2011
pawn Код:
stock GetAchievementDescription(Achievement[])
{
new query[128], result[128];
format(query,512,"SELECT Description FROM Achievements WHERE FullName = '%s'",Achievement);
JA_Result=db_query(JA_Database,query);
db_get_field_assoc(JA_Result,"Description",result, 128);
db_free_result(JA_Result);
return result;
}
Still the same
Re: new to SQL -
Sergei - 14.01.2011
Is database even opened? Is description valid field. Is query actually valid? Have you run query in database manager and got result?