Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

C and an online MySQL database

Thoth123Thoth123 Member Posts: 3
OK, so I have an online database (MySQL) on my website (PHP/HTML).

I am writing a program in C that will update my MySQL database on my own computer(MySQL library), but what I want to do is update my db on the website at the same time. So I know that I will need some server side scripting to accept data (my host doesn't allow direct access to the db) which is a whole other issue. But what I don't know, at all, is how to send the data out from my c program to the website.

If anyone can help it would be greatly appreciated.

If it matters I use Code:Blocks on a Windows 2000 machine.

Comments

  • stoberstober Member Posts: 9,765 ✭✭✭
    : OK, so I have an online database (MySQL) on my website (PHP/HTML).
    :
    : I am writing a program in C that will update my MySQL database on my
    : own computer(MySQL library), but what I want to do is update my db
    : on the website at the same time. So I know that I will need some
    : server side scripting to accept data (my host doesn't allow direct
    : access to the db) which is a whole other issue. But what I don't
    : know, at all, is how to send the data out from my c program to the
    : website.
    :
    : If anyone can help it would be greatly appreciated.
    :
    : If it matters I use Code:Blocks on a Windows 2000 machine.
    :

    I doubt that you can -- security on website side will probably not allow it. You will have to run the program on the server itself (CGI Programs) and grant it appropriate permissions. How to do that depends on the web server. A CGI program written C or C++ can use normal ODBC or MySQL API functions/libraries to access the database.

    =============================================
    never lie -- the government doesn't like the competition. (Author unknown)
  • Thoth123Thoth123 Member Posts: 3
    Thanks for the reply stober,

    That is exactly what I want to do.. send data to my website (to a script or CGI or whatever, I don't know) and then have my website update the database on the server side. I need to find how to do 2 things:

    1) How to send data to my website from my c program. Is it done through an html call (http_send ?? or something like that)

    2) How to receive data on the server side (CGI I guess from your comment) and then update the db. (which I can do with PHP, but it's the actual receiving of the data I need to figure out)

    Thanks.
  • Thoth123Thoth123 Member Posts: 3
    OK, I think I might have figured it out.

    When I am ready to update the online db I simply use the WinInet API to send an html request to the website telling it an update is available and then use PHP to upload a specific file from my harddrive to the website, parse it and then use that info to update the db.

    Has anyone else accomplished this ? Or have a better method ?
Sign In or Register to comment.