Solved

Mysql c api doubt

Posted on 2004-03-20
1
262 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
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

706 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now