There's a few different ways as I see it.
1) give your c++ application direct access to the database, which you probably don't want.
2) Have the c++ write a data file to be later parsed by a php script to insert the data and then move the data file out of the way to make way for a new one. You then can schedule / cron the php script to execute periodically.
3) Optionally, if you want it more real time solution, you can write a daemon in php that listens on a socket (yes, I've done it, and it works great), and then have your c++ app connect to you php daemon, transfer the data, which then gets put it in the database.