Posted by Mike Youell on 10/13/43 11:44
Hi Dejan,
Try this:
HOST SCRIPT
1) create a script called get_insert_keys.php which does a "select
broj_tel from table2" and outputs all the values using the php echo
function.
LOCAL SCRIPT
1) create a script on your local machine which does a
file_get_contents("http://www.yourdomain.com/cgi-bin/get_insert_keys.php?username=fred&password=blahblah");
and reads the broj_tel values into an array. (one-way encrypt password
before sending like this!)
2) Now you have a list of broj_tel's from table 2 (but on your local
machine). Now create a CSV file of all the fields in table1 that have
a broj_tel from table2 (see the array for broj_tel's from table2).
3) Now use the php ftp functions to copy this CSV data file to your
host to a designated directory, e.g. /data/ or whatever.
4) Then use
file_get_contents("http://www.yourdomain.com/cgi-bin/insert_values_from_table1.php?username=fred&password=blahblah");
to call a script on the host to insert the values using the new CSV
datafile.
This may seem complicated (it's actually quite easy to implement) but
at least it can be automated easily without the use of phpmyadmin etc.
You could also gzip the data before sending.
Note that you run the local script to trigger everything off. It is
that script which drives the whole thing.
There's probably a much easier way to do this. If this is the case
then someone please tell me too :o)
Cheers,
Mike Youell.
[Back to original message]
|