Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to get data from mysql without connecting to mysql directly

Status
Not open for further replies.

Edward07

Programmer
Apr 13, 2007
49
NL
I want to get some data from mysql but unfortnetly my hosting company dosn't allow vb6 to connect to mysql. Could any one tell me what other ways i have to get data from mysql using php and use it in vb6 application.Thanks
 
write a PHP page that takes a SQL query as a parameter and returns a XML recordset with the results in.

You could even look at replicating the persisted XML format that the ADO Recordset uses to make your life really easy.
 
Many Many thanks for this cool idea. Could you explain to me what you mean when saying?:

Code:
replicating the persisted XML format that the ADO Recordset uses
 
Ok, first up is the Recordset's own XML structure. If you can duplicate the format then you could return your data from your PHP page and push it straight into a Recordset:

But I think (not tried it) that if you take a looksie here:


you should be able to push a simple XML stream into the Recordset, as long as the XML stream you build up is valid.
 
Well, also, a way to get a look at the format that a persisted ADO Recordset has is to simply create a recordset, save it, and examine the result. I would suggest that you investigate the Save method of the ADO Recordset object if you wish to go this way.

HTH

Bob
 
Nimroduk could you tell me how to make post request to php script from within vb6. I want to pass textbox value to this php script.
 
The following code pushs data at a webservice and waits for a HTTP 200 OK reponse and "OK" in the response text.

xddProductBlock is the post variable name, so the name of the variable that is exposed in php as $_POST["variablename"]
vsCSV is the data that is assigned to the variable.

Code:
Set loHTTP = New MSXML2.XMLHTTP30
'Open the URL passing the data
With loHTTP
    .open "POST", lsProtocol & lsServer & "/" & lsURL, True
    'Now Get the response, give ourselves upto 2 mins to upload and receive response
    ldTimer = Timer
    While (Not lbAbortUpload) And (Not lbUploadComplete)
        'Check to see if we have sent !
        If Not lbSentRequest Then
            lbSentRequest = True
            .send xddProductBlock & "=" & vsCSV
        
        ElseIf (Timer - ldTimer) > liTimeOut Then
            lbAbortUpload = True
            .abort
            
        ElseIf .readyState = 4 Then
            lbUploadComplete = True
            
        End If
        DoEvents
    Wend
    'Do we have a response ?
    If lbUploadComplete And .Status = 200 Then
        'Check the response
        If UCase(.responseText) = "OK" Then
            lbReturn = True
        Else
            noError.TLCErr TypeError, "Server Returned [" & loHTTP.responseText & "] Response.", "TLCWebImport::StockExport::nfbSendXMLData"
        End If
    Else
        noError.TLCErr TypeError, "Failed to Send to Server [" & loHTTP.Status & " : " & loHTTP.statusText & "]", "TLCWebImport::StockExport::nfbSendXMLData"
        lbReturn = False
    End If
End With

There is a lot of info on this forum regarding the use of the MSXML2.XMLHTTP30, I'd be surprised if a search didn't yield the solution :)

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top