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

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

Also you should consider to start using mysqli*

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)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.