What is best way to get one row from a mysql table (with many columns) so I can use several several fields from that row for calculations in a C program?
After executing a succesful SELECT command using mysql_query, is there an alternative to using mysql_store_result?

So much left unspecified. Did you want to use MySQL from a C app? What's wrong with mysql_store_result?

First, in posting this on Daniweb, I made a mistake in the title. I meant to write “Reading Data from MYSQL using Linux C “. I tried to change that after the fact, but was unsuccessful.

Thank you rproffitt for you comment. It sent me to the documentation where I learned about the multiple statement capability of mysql_query. That helps a lot, but my question remains. . .

Using MS Access, I have a table of stock purchases. Each trade (or row) in that tables has data like stock symbol, number of shares, price, commission, etc. Now with Access BASIC I can select a trade as follows, once I have opened the database as “db”, omitting checks for errors:

Set rs = db.OpenRecordset(“Select * from Trades where . . .”)

Basis = rs!numshares * rs!price + rs!commission

Then I can display:
rs!trdate
rs!symbol
Basis

So my question really is what is the best way to do the same thing with MYSQL and C? I admit to being a newbie with MYSQL, so you won’t hurt my feelings if this is a dumb question. THANKS!

Thanks for clarification. Before we can proceed, there is no builtin API to C to get at MySQL directly so the First Order Of Business would be to find a library to help us connect and use MySQL from C.

From there we might make some progress.

How about https://zetcode.com/db/mysqlc/ ? First hit on Google and seems to be a good enough tutorial.

However this won't be all we need to know because we'll have to get MySQL installed, running and maybe some MySQL management tool. This is a personal choice so I'd start with https://www.tecmint.com/mysql-gui-tools-for-linux/

commented: Good ideas for me to try. Thanks again.” +3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.