如何在数据库中存储关联数组数据

时间:2014-02-19 09:36:45

标签: php mysql asana

这是我的代码:

$user_detail = $client->fetch("https://app.asana.com/api/1.0/users/"
    .$response['result']['data'][$i]['id'].'.json');


echo  $q="INSERT INTO `asana_users`(`Name`, `Email`,`Workspaces`) VALUES  ('".$user_detail['result']['data']['name']."',
    '".$user_detail['result']['data']['email']."','" .implode("'),
    ('"$user_detail['result']['data']['workspaces'][$i])."') "; 

$user_fetch = mysql_query($q);
  1. 我想插入

    的数据
               [workspaces] => Array
                    (
                        [0] => Array
                            (
                                [id] => ********
                                [name] => a.com
                            )
    
                        [1] => Array
                            (
                                [id] => **********
                                [name] => Personal Projects
                            )
    

    这里是我的数组,现在我想添加索引0包含id,工作区域中的名称。

  2. 其次如何获取数据

  3. 请建议

            Array
             (
          [result] => Array
                (
            [data] => Array
            (
                [id] => ****
                [name] => hiuh
                [email] => a@d.com
                [photo] => 
                [workspaces] => Array
                    (
                        [0] => Array
                            (
                                [id] => 1
                                [name] => a.com
                            )
    
                        [1] => Array
                            (
                                [id] => 494
                                [name] => Personal Projects
                            )
    
                    )
    
            )
    

    我希望如果我想要获取工作区名称然后我可以获取整个workspce
     数据

0 个答案:

没有答案