CMD:factions(playerid, params[])
{
new Query[256];
new DBResult:Result;
format(Query, sizeof(Query), "SELECT 'Name' FROM `Faction`");
Result = db_query(Database, Query);
if(db_num_rows(Result))
{
new Field[30];
db_get_field_assoc(Result, #Name, Field, 30);
printf("%s",Field);
}
return 1;
}
CMD:factions(playerid, params[])
{
new DBResult:Result;
Result = db_query(Database, "SELECT 'Name' FROM `Faction'");
if(db_num_rows(Result))
{
do
{
new Field[30];
db_get_field_assoc(Result, 'Name', Field, 30);
new string[120];
format(string,sizeof(string),"%s",Field);
SCM(playerid,COLOR_YELLOW,string);
}
while(db_next_row(db_result));
}
db_free_result(Result);
return 1;
}
CMD:factions(playerid)
{
new DBResult:Result;
Result = db_query(Database, "SELECT 'Name' FROM `Faction`");
if(db_num_rows(Result))
{
new Field[30], string[100];
db_get_field_assoc(Result, 'Name', Field, 30);
format(string,sizeof(string),"%s",Field);
SCM(playerid,COLOR_YELLOW,string);
while(db_next_row(db_result));
}
db_free_result(Result);
return 1;
}
D:\Softwares\Cops And Robbers\gamemodes\Sandhu.pwn(9159) : error 027: invalid character constant
D:\Softwares\Cops And Robbers\gamemodes\Sandhu.pwn(9159) : error 017: undefined symbol "ame"
D:\Softwares\Cops And Robbers\gamemodes\Sandhu.pwn(9159) : warning 215: expression has no effect
D:\Softwares\Cops And Robbers\gamemodes\Sandhu.pwn(9159) : error 001: expected token: ";", but found "-identifier-"
D:\Softwares\Cops And Robbers\gamemodes\Sandhu.pwn(9159) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
db_get_field_assoc(Result, 'Name', Field, 30);
CMD:factions(playerid, params[]) { new DBResult: Result = db_query(Database, "SELECT `Name` FROM `Faction"); if (db_num_rows(Result)) { new Field[30]; do { db_get_field_assoc(Result, "Name", Field, 30); // or // db_get_field(Result, 0, Field, 30); SCM(playerid, COLOR_YELLOW, Field); } while (db_next_row(Result)); } db_free_result(Result); return 1; }
Thx! A rep to you both! So this sqlite thingy works on frag host too [Frag is linux]?
|