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
Solved

Mysql c api doubt

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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to get time_t value that is a week old 6 169
Trouble linking program with -lcrypt 3 155
outlook office 365 8 143
A  &&  B  || (C||D) how it works in c 7 100
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

856 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