0

I am trying to print my data in columns. For some reason every column but the last one lines up. Is there a way to fix this?

while ((row = mysql_fetch_row(result))) 
{ 
    //printf("198\n");
    for(int i = 0; i < num_fields; i++) 
    {
        //printf("----------\n");           
        printf("%25s         ",row[i]);
        if(row[i] == NULL)
        {
            printf("No values exist\n");
        }
        //printf("----------\n");
        //printf("%s      ", row[i] ? row[i] : "NULL"); 
    } 
        printf("\n"); 
}

My Output:

             Sang Hun Lee                             VINES                                KR
            Jung Hyun Lim                             Crazy                                KR
           Tom Brekelmans                              PoYo                                NL
            Shin Jung Min                         Superstar                                KR
         Lacroix Corentin                           Makouni                                BE
           Beak Seung-Joo                   ButterflyEffect                                KR
           Choi Joon Hyuk                                xD                                KR
            Kwun Jung Woo                              Fake                                KR
       Kalle Pietiläinen                          Prospect                                SE
5
Contributors
4
Replies
23
Views
3 Weeks
Discussion Span
Last Post by cereal
0

You are set 25 symbols (+9 white space) width for each column - maybe output window is not so large

Edited by AndrisP

1

Pietiläinen

Just a guess...

Is it possible that you are using a one byte character set where the a-umlaut is a 2-byte extended code? (easy to check - just replace it with an ordinary a and see what happens)

Edited by JamesCherrill

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.