Transfer data from mysql to access using PHP & VB
Posted: Tue Oct 11, 2011 11:12 pm
I have wanted to tranfer some some data from a Mysql database (On a remote server) to a MS Access database (on local mechine) interfacing PHP & VB (VB6).
I did it using below mwthod, but I think it isn't a good solution.
1. Select data from mysql and print data using php as below,
2. Read this output using VB, Split data and insert data into the Access database as below,
I hope you will have another idea to do this.
Please help me.
Thankz,
Rksk.
[ Post made via Mobile Device ]
I did it using below mwthod, but I think it isn't a good solution.
1. Select data from mysql and print data using php as below,
Code: Select all
$user = '1';
$q=mysql_query("SELECT id,time,user_id,text FROM posts WHERE user_id = '$user' ORDER BY id");
while ($post = mysql_fetch_array($q))
{
echo $post['id'].",".$post['time'].",".$post['user_id'].",".$post['text']."||";
}
Code: Select all
Dim mydb As Database
Dim myrs As Recordset
Dim s, s2 As String
Dim sItems() As String
Dim sItems2() As String
Set mydb = OpenDatabase("data.mdb")
Set myrs = mydb.OpenRecordset("posts", dbOpenTable)
s = InternetGetFile("http://mydomain.com/myscript.php")
sItems() = Split(s, "||")
Dim X As Integer
For X = 0 To UBound(sItems)
sItems2() = Split(sItems(X), ",")
myrs.AddNew
myrs.Fields("id") = sItems2(0)
myrs.Fields("time) = sItems2(1)
myrs.Fields("user_id") = sItems2(2)
myrs.Fields("text") = sItems2(3)
myrs.Update
Next X
I hope you will have another idea to do this.
Please help me.
Thankz,
Rksk.
[ Post made via Mobile Device ]