Re: Best way to access field name in C

2004-10-27 Thread Aftab Jahan Subedar
Hey have you checked thi shttp://www.geocities.com/jahan.geo/mysql_c_by_example.html? Matthew Boehm wrote: What is the best way to access a specific field in C? Its really easy in PHP... PHP --- $res = mysql_real_query($mysql,"SELECT col1, col2 FROM table"); while($row = mysql_fetch_row($res)

Re: Best way to access field name in C

2004-10-11 Thread SGreen
IT may seem loopy to you but how do you think that PHP does it? Somewhere in the PHP record handling code is a loop that reads all of the field names. Now, it might cache those names into something like an array, a linked list, or a hash map so that looking them up again doesn't require a full

Re: Best way to access field name in C

2004-10-11 Thread Philippe Poelvoorde
Matthew Boehm wrote: What is the best way to access a specific field in C? Its really easy in PHP... http://dev.mysql.com/doc/mysql/en/mysql_fetch_row.html you won't have the hash-table feature offered by PHP, but nothing stop you to do the same. PHP --- $res = mysql_real_query($mysql,"SELECT

RE: Best way to access field name in C

2004-10-11 Thread Tom Horstmann
Dear Matthew, > PHP > --- > $res = mysql_real_query($mysql,"SELECT col1, col2 FROM > table"); while($row = mysql_fetch_row($res)) { > print $row['col1']; > print $row['col2']; > } > > Is the only way/best way to do the above in C by using a > nested for-loop? > Ex: > > fields = mys

Re: Best way to access field name in C

2004-10-11 Thread Karam Chand
Hello, In C you dont have named access to the columns as they are returned as an array of char*. The only solution would be to access it using its index value. Like PHP, you have to do mysql_fetch_row() anyway. After that access the row by its index. If you prefer named access and dont mind a mi

Best way to access field name in C

2004-10-11 Thread Matthew Boehm
What is the best way to access a specific field in C? Its really easy in PHP... PHP --- $res = mysql_real_query($mysql,"SELECT col1, col2 FROM table"); while($row = mysql_fetch_row($res)) { print $row['col1']; print $row['col2']; } Is the only way/best way to do the above in C by usin