Results 1 to 14 of 14

Thread: VB6 to PHP/MySQL Interface

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Location
    Craiova, Romania
    Posts
    140

    VB6 to PHP/MySQL Interface

    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);
    }
    ?>
    Last edited by cliv; Jan 17th, 2014 at 01:33 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width