Solved

Mysql c api doubt

Posted on 2004-03-20
1
271 Views
Last Modified: 2010-04-15
Hi experts,

       I am writing a c program using mysql api. My mysql program is returning the output like


 col1          col2                    col3                  col4                                            col5

 
  1  ||    20040319092354 ||    37   ||    Application Error Notification    ||       Relevant line :<META

  2  ||    20040319092356 ||    30   ||    Application Error note            ||       Relevant line2 :<META


and so  on upto 'n' rows..........




I want the output to be in form


col1:::1  col2:::20040319092354  col3:::37  col4:::Application Error Notification   col5:::Relevant line :<META (eol)
col1:::1  col2:::20040319092354  col3:::37  col4:::Application Error Notification   col5:::Relevant line :<META (eol)


thus 30 rows........

Please give me idea ( preferrably code snippet) to do this......
Early responses are greatly appreciated.....


Warm regards

NP

0
Comment
Question by:msanoop
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 9

Accepted Solution

by:
ankuratvb earned 250 total points
ID: 10642998
Borrowing code from ur other thread:

if (result = mysql_store_result(mysql))
   {
      for(r=0;r<=mysql_field_count(mysql);r++)
       {
          row=mysql_fetch_row(result);
          if(row<0) break;
          for(t=0;t<mysql_num_fields(result);t++)
            {
                  printf("Col:%d:::%s  ",t+1,row[t]);
            }
          printf("\n");
       }
    }
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question