Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21090

VB6 to PHP/MySQL Interface

$
0
0
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.
Php script i intend to use is from this site :
http://iesromerovargas.es/recursos/e...4android25.htm

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);
}
?>


Viewing all articles
Browse latest Browse all 21090

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>