我有一个 html/javascript 页面,它创建了一些类似于图形的数据,它是一个节点数组,不同类型,具有不同的属性,包括节点之间的多个交叉引用,有时还有文本,必须存储在单独的表,因为它可能被翻译成其他语言。
json stringify 可能如下所示:
[{"type":"bid-rama","parent":-1,"child":1,"color":"silver","state":{"bid":[0,0,1],"length":3,"turn":"lho","main":{"s":"a83","h":"kq84","d":"jt52","c":"94"},"rho":{"s":"kj92","h":"j3","d":"q93","c":"qj83"},"lho":{"s":"t7","h":"9765","d":"k87","c":"at76"},"cho":{"s":"q654","h":"at2","d":"a64","c":"k52"}}},{"type":"bid-nodo","parents":[0],"fila":2,"children":{"0":2,"-1":4,"5":6},"options":{"0":"mog","-1":"mop","5":"mor","4":"blue","7":"red"},"texts":{"blue":"texto axu","red":"testo roho"},"state":{"bid":[0,0,1],"turn":"main"}},{"type":"bid-rama","parent":1,"child":3,"color":"green","state":{"bid":[0,0,1,0],"length":0,"turn":"lho"}},{"type":"bid-nodo","parent":2,"fila":3},{"type":"bid-rama","parent":1,"child":5,"color":"purple","state":{"bid":[0,0,1,-1],"length":0,"turn":"lho"},"texts":{"0":"blalb","1":"hrhrhr ","2":"meee[r][s] fas","3":"[10] is 10 [d] no"}},{"type":"red-dot","parent":4,"fila":3},{"type":"bid-rama","parent":1,"child":7,"color":"green","state":{"bid":[0,0,1,5,0,0,0],"length":0,"turn":"lho"}},{"type":"bid-ctr","parent":6,"fila":3,"state":{"bid":[0,0,1,5,0,0,0],"contract":5,"declarer":"south"},"color":"yellow","playnode":8},{"type":"cpl-ctr","parents":[7],"fila":1,"trump":"n","declarer":"main","color":"yellow","child":9,"state":{"main":{"s":"a83","h":"kq84","d":"jt52","c":"94"},"rho":{"s":"kj92","h":"j3","d":"q93","c":"qj83"},"lho":{"s":"t7","h":"9765","d":"k87","c":"at76"},"cho":{"s":"q654","h":"at2","d":"a64","c":"k52"},"turno":"lho","trick":"","history":"","trNS":0,"trEW":0}},{"type":"cpl-rama","parent":8,"child":10,"fila":2,"color":"yellow","state":{"main":{"s":"a83","h":"kq84","d":"jt52","c":"94"},"rho":{"s":"kj92","h":"j3","d":"q93","c":"qj83"},"lho":{"s":"t7","h":"9765","d":"k87","c":"at76"},"cho":{"s":"q654","h":"at2","d":"a64","c":"k52"},"turno":"lho","trick":"","history":"c6c2cqc4c3c9ca","trNS":0,"trEW":0}},{"type":"red-dot","parent":9,"fila":2}]
我使用 ajax 将其发送到 php 页面进行存储。
到目前为止,我只进行了基本的 mysql 查询,例如插入用户名、密码等。
但是现在看起来我必须在一个表中插入东西,然后查看另一个表,从那里插入以前寄存器的 id,这样几次,等等。
我对插入过程中发生的一些不好的事情感到困扰,使我的数据库中的数据不一致,我记得我被告知应该一步完成以避免这种情况,但我想不出一种方法来做到这一点.