dpbfb7119 2010-08-19 07:10
浏览 22
已采纳

使用PHP将javascript数组添加到数据库的想法

i need to push data in javascript array into database using PHP

first i have multidimentional array in js.

Brady [0] [0] = "1";
Brady [0] [1] = "Carol";
Brady [1] [0] = "2";
Brady [1] [1] = "Jan";
Brady [2] [0] = "3";
Brady [2] [1] = "Mike";

and i have table in database such as (id, name)

second if i need to delete some rows in array before i added how can i do?

third how can i push it to database after i delete data in array?

  • 写回答

2条回答 默认 最新

  • duanbozhong9689 2010-08-19 07:24
    关注

    You must know the basics of AJAX concept. Parameter passing of its your own interest either

    1. separate items

      ex: xmlHttpReq.open('GET', "/test.json&day=" + day + "&month=" + month + "&year=" + year, true);

    2. concat array as a string with special character and send ,parse it at backend

      ex:

      string sample=array[0]+'|'+array1....

         xmlHttpReq.open('GET', "/test.json&arrtest=" +sample , true);
      

      at backend use explode string to make it as array again.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码