[MySQL] Unloading information from database
#1

I didn't get any help in my previous topic so I thought I would make a new one but a little bit more detailed.

I get this problem when I'm trying to get Text information off a database. When I start up the server it is meant to say the name of the faction which has loaded but unforunatly it loads up a blank space:
Code:
[19:55:06] [Factions] Name: ID: 0
[19:55:06] [Factions] Name: ID: 1
[19:55:06] [Factions] Name: ID: 2
The IDs load up fine but the name doesn't. This is my loading code:
pawn Code:
public LoadFaction()
{
  new DataString[ 128 ], Query[ 128 ], idx;

    format( Query, sizeof( Query ), "SELECT * FROM factions");
    mysql_query( Query );
    mysql_store_result();

    while( mysql_fetch_row_data() )
    {
        mysql_fetch_field( "FactionID", DataString );
        DynamicFactions[ idx ][ FactionID ] = strval( DataString );

        mysql_fetch_field( "FactionName", DataString );
        DynamicFactions[ idx ][ FactionName ] = strval( DataString );

        printf("[Factions] Name: %s ID: %d",DynamicFactions[ idx ][ FactionName ],DynamicFactions[ idx ][ FactionID ]);

        idx++;
    }

    mysql_free_result();

    return 1;
}
(I've left some of the code out which wasn't needed)

On the MySQL database my table feild is:
Code:
varchar(68) 	latin1_swedish_ci
Does anyone know what I'm doing wrong? If you need more information just say and I'll explain it some more, thanks.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 9 Guest(s)