WebSQL数据库上传 [英] WebSQL Database Upload

查看:150
本文介绍了WebSQL数据库上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WebSQL数据库,我试图连接到一个PHP脚本,并将该数据库转储到服务器上的另一个。

I have a WebSQL database, and am trying to connect to a PHP script, and dump that database into another one on the server.

如何格式化javascript / jquery为了正确地这样做?

How do I format the javascript / jquery in order to do that correctly?

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

I guess I am asking, how do I dump all of my data in my tables into my PHP script, so that it can update and insert the data into another database on the server?

我不知道在哪里开始这个。

I have no clue where to even begin with this.

推荐答案

这个问题中的术语有点混乱。如果您试图将数据库从一个位置复制到同一服务器上的另一个位置,则最多只能使用PHP。

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.

如果您尝试将数据库复制到客户端(而不是服务器)上的Web SQL数据库,我发现了一种一次性的方式来实现这一点。我说round-a-bout,因为在我的情况下,我不得不将数据库从服务器复制到本地客户端文件(aka跨域)。简而言之:

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)使用PHP从服务器创建一个json_encode版本的数据库,使用fwrite在服务器上创建一个.json文件

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)使用 php proxy 提交json数据,为代理创建一个jquery ajax调用,用于您创建的.json文件

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)使用javascript将JSON数据存储到客户端的web sql 数据库。

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

这篇关于WebSQL数据库上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆