Autor Tema: VB6 to PHP/MySQL Interface  (Leído 3002 veces)

0 Usuarios y 1 Visitante están viendo este tema.

cliv

  • Kilobyte
  • **
  • Mensajes: 69
  • Reputación: +1/-2
    • Ver Perfil
VB6 to PHP/MySQL Interface
« en: Enero 10, 2014, 04:45:53 am »
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.

I need to do something like that in vb6.

Código: [Seleccionar]
<?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);}?>
« última modificación: Enero 17, 2014, 06:02:18 am por cliv »

cliv

  • Kilobyte
  • **
  • Mensajes: 69
  • Reputación: +1/-2
    • Ver Perfil
Re:VB6 to PHP/MySQL Interface
« Respuesta #1 en: Enero 17, 2014, 06:03:56 am »
I use
Código: [Seleccionar]
Option Explicit
Private WithEvents httpURL As WinHttp.WinHttpRequest
Const HTTPREQUEST_PROXYSETTING_DIRECT = 1

Private Sub cmdGo_Click()

    httpURL.SetProxy HTTPREQUEST_PROXYSETTING_DIRECT
    httpURL.Open "GET", "http://www.URLsite.com/code.php?query=%22SELECT%2B*%2BFROM%2BTable%22"
    httpURL.Send
   
    txtGET.Text = httpURL.ResponseText
End Sub

but return was "\nQuery was empty"
What is correct URL-encoded data?...how to send variable $query from php code?

VigiRed

  • Bytes
  • *
  • Mensajes: 19
  • Reputación: +4/-4
  • Soy electronico
    • Ver Perfil
Re:VB6 to PHP/MySQL Interface
« Respuesta #2 en: Enero 24, 2014, 09:12:05 pm »
no entiendo nada