I need to create a program in VB6 that interfaces with PHP scripts to access a MySQL database.
Users wishing to send queries via Visual Basic to a remote MySQL server that doesn't otherwise allow remote access.
I don't work until now with POST/GET ... so please post me a sample if you have.
Code:<?php $databasehost = XXXXXXXXXX; $databasename = XXXXXXXXXX; $databaseusername =XXXXXXXXXX; $databasepassword = XXXXXXXXXX; $con = mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error()); mysql_select_db($databasename) or die(mysql_error()); mysql_query("SET CHARACTER SET utf8"); $query = file_get_contents("php://input"); $sth = mysql_query($query); if (mysql_errno()) { header("HTTP/1.1 500 Internal Server Error"); echo $query.'\n'; echo mysql_error(); } else { $rows = array(); while($r = mysql_fetch_assoc($sth)) { $rows[] = $r; } print json_encode($rows); } ?>




Reply With Quote