TedCopple Posted February 17, 2011 Share Posted February 17, 2011 I have made a script that reads values from MySQL database and "Echo" them. When I run the script the variables from the DB are printed on the page as they should be. Now I want to make those variables accessible to my C++ application to read. I am using WinInet functions to communicate with the script. Can somebody explain to me what I have to do in my php script be able to access the variables directly. The below script gets the value $var = $_GET['Version']; that is sent from my C++ app. It then reads from the DB table the Version number entered in the table. Then compares the version number from my C++ app to the DB version number. Now I want to make the Version Number from the DB accessible to my C++ app. I want to be able to get the exact value stored in: $row['VersionNumber']; with my C++ app. <?php $dbhost = 'host'; $dbuser = 'dbusername'; $dbpass = 'dbpass'; mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'MyDbsName'; mysql_select_db($dbname); $query = mysql_query("SELECT * FROM Users"); $var = $_GET['Version']; while($row = mysql_fetch_array($query)) { if($var == $row['VersionNumber']) { echo $row['VersionNumber']; } } ?> Quote Link to comment Share on other sites More sharing options...
cgsmith105 Posted February 17, 2011 Share Posted February 17, 2011 Hi TedCopple, Are WinInet functions the best way to pull data? What is the purpose of going through PHP to access the database instead of through C++? What about reading the values in an XML format? That way you can still program in PHP and then just output it to a more acceptable format. Something similar to: ... echo "<version>$versionNumber</version>" ... Quote Link to comment Share on other sites More sharing options...
TedCopple Posted February 17, 2011 Author Share Posted February 17, 2011 Hi TedCopple, Are WinInet functions the best way to pull data? What is the purpose of going through PHP to access the database instead of through C++? What about reading the values in an XML format? That way you can still program in PHP and then just output it to a more acceptable format. Something similar to: ... echo "<version>$versionNumber</version>" ... No real purpose I suppose. I am just trying to learn some new things I have never tried before. I finally got my WinInet function working properly today to post data to my website, so I wanted to give a shot at doing the same thing but in the opposite form. Right now I am just trying to pull the version number entered on the table, and in my C++ app, compare that version with the current version of the C++ app and then log out the result. Its just a testing phase atm. If you could help me get it in order the way I have described it would much benefit me to explore other methods and such as you have described. Quote Link to comment Share on other sites More sharing options...
TedCopple Posted February 17, 2011 Author Share Posted February 17, 2011 Wonder if I can get a bump? Sorry if its not allowed here, but I really need some guidance here. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.