weixin_33730836 2016-10-18 06:31 采纳率: 0%
浏览 18

没有得到数组的确切值

my orginal output is

below

[status] => 1
[schedule_status] => 1
[cid] =>3
[cdate] => 16-10-18 01:10:52
[did] => 16
[jid] => 4

After i use seperate array value using

$count = count($_POST[user]);

if($count>=1) { 

    for($i=0;$i<$count;$i++) {

        $candi_id =array('cid'=>$_POST[user][cid][$i]);

        $scheduleUp = array('cid'=>$_POST[user][cid][$i],'jid'=>$_POST[data][jid][$i],'did'=>$_POST[data][did][$i]);
    }
}

iam getting did is 1 why?

  • 写回答

1条回答 默认 最新

  • larry*wei 2016-10-18 06:36
    关注

    You have single dimensional array. So why you try to fetch the data as loop? do not use $_POST[data][did][$i] please use as $_POST[data][did]

    What it will do is: $_POST[data][did] is return the result of 16 now from the string you are trying to access as array and fetch record for [$i] and starting of $i is 0 so it will return the 1st character from the string. If it is of 1 then it will return 6.

    So please try to remove [$i] from the end.

    评论

报告相同问题?

悬赏问题

  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题