I use :

       numRows = mysql_num_rows( Result);
        numFields = mysql_num_fields( Result);

       for( j=0; j < numRows; j++) {
                mysql_data_seek( Result, j);
                CurrentRow = mysql_fetch_row( Result);
                for( k = 0; k < numFields; k++)
                        printf( "%s\t", CurrentRow[ k]);
                printf( "\n");
        }

and it works
Try to add

mysql_data_seek( Result, 0);

before your loop.

Santino

At 14:06 -0800 26-10-2003, Carl B. Constantine wrote:
I'm writing an application and have the following SQL Query written in
C/GTK+ code:

select customer_id, phone, last_name, first_name,
        company, account_code from customers;

OK, I then issue the following C commands:

results = mysql_store_result(conx);
numRows = mysql_num_rows(results);
g_print("There are %d rows returned\n", numRows);
return(results);

The print shows 7 rows returned, which is correct. I then have a while
loop to step through each row like so:

i = 0;

while (db_row = mysql_fetch_row(results))
{
g_print("getting data...\n");
id = db_row[0];
phone = db_row[1];
last = db_row[2];
first = db_row[3];
company = db_row[4];
account = db_row[5];
row = g_strconcat(db_row[0],",",db_row[1],",",db_row[2],",",db_row[3],",",db_row[4], ",",db_row[5],0L);
g_print("Row %d is: %s\n",i,row);
i++;
}


OK, the problem is, I don't get the very first row, I only get the last
6 rows. Can anyone tell me WHY this is? It doesn't really make sense.
This code supposedly prints rows 1-7 but really only prints 2-7.

Your help is greatly appreciated.

--
 .''`.      Carl B. Constantine
: :' :     [EMAIL PROTECTED]
`. `'    GnuPG: 135F FC30 7A02 B0EB 61DB  34E3 3AF1 DC6C 9F7A 3FF8
  `-  Debian GNU/Linux -- The power of freedom
  "Claiming that your operating system is the best in the world because more
  people use it is like saying McDonalds makes the best food in the world."

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to