0

我有一个 WebSQL 数据库,正在尝试连接到 PHP 脚本,然后将该数据库转储到服务器上的另一个数据库中。

如何格式化 javascript / jquery 以正确执行此操作?

我想我在问,如何将表中的所有数据转储到我的 PHP 脚本中,以便它可以更新数据并将其插入服务器上的另一个数据库?

我不知道从哪里开始。

4

1 回答 1

0

The terminology in this question is a little confusing. If you're trying to copy the database from one location to another on the same server, you would only use PHP at most. This could also be done with just your sql administration.

If you are attempting to copy the database to a "Web SQL" database on a client (not a server), I've found a round-a-bout sort of way to accomplish this. I say round-a-bout because in my case I had to copy the database from the server to local client files (aka cross domain). In short:

1) Use PHP to create a json_encode version of your database from the server, using fwrite to create a .json file on the server

2) Using a php proxy to deliver the json data, make a jquery ajax call to the proxy, for the .json file you created

3) Use javascript to store the JSON data into the client's "web sql" database.

于 2012-10-03T14:39:12.970 回答