dqwmhrxt68679 2017-02-17 07:00
浏览 128

我有一个mysql数据库查询,在android中我想访问表列的值

//get customer
                            $query=$this->db->query("SELECT `c`.`customer_id`,`a`.`firstname`,`a`.`lastname`,`a`.`address_1`,`a`.`address_2`,`a`.`postcode` AS `pincode`,`c`.`telephone`,`c`.`email`,`c`.`fax` FROM `oc_address` AS `a` INNER JOIN `oc_customer` AS `c` ON `c`.`address_id` = `a`.`address_id` WHERE `c`.`customer_id`=".$this->request->post['customer_id']);
                            $cust=$query->row;

                            //get pincode for delivery from session
                            $query=$this->db->query("select pincode from `oc_chat_session` where `cust_id` =".$cust['customer_id']." and `session_id` = ".$this->request->post['session']);
                            $sess=$query->row;

                            //save order
                            $this->db->query("INSERT INTO `oc_chat_order` (`session_id`, `vendor_id`, `cust_id`, `cust_name`, `cust_address`, `cust_pincode`, `cust_mob`, `cust_email`, `createdon`) VALUES (".$this->request->post['session'].",".$this->request->post['vendor_id'].",".$this->request->post['customer_id'].",'".$cust['firstname']." ".$cust['lastname']."','".$cust['address_1']." ".$cust['address_2']."','".$sess['pincode']."','".$cust['telephone']."','".$cust['email']."',NOW())");
                                                                                                                                                                                                                                                                                                                                                $query=$this->db->query("SELECT @@IDENTITY as `order_id`");

whenever I am trying to access the fax field and email field in the android app I am getting a null value

    messageList = new ArrayList<HashMap<String, String>>();
    app=((MyApplication) getApplicationContext());

    Bundle extras = getIntent().getExtras();

    if(extras != null) {
        order_id = extras.getString("order_id");
        orderdate = extras.getString("orderdate");
        cust_name = extras.getString("cust_name");
        cust_address = extras.getString("cust_address");
        cust_pincode = extras.getString("cust_pincode");
        cust_mobile=extras.getString("cust_mobile");
        cust_email=extras.getString("cust_email");
        action=extras.getString("action"); //setaccepted, setdelivered
    }

    bt = (Button) findViewById(R.id.btnAction);
    switch (action)
    {
        case "setdelivered":{
            bt.setText("Delivered");
            break;
        }
        case "setaccepted":{
            bt.setText("Accept");
            break;
        }
        default:
    }

    try {
        String dpart = orderdate.substring(0, 10);
        String tpart = orderdate.substring(11, 19);
        orderdate = dpart.substring(8,10);
        orderdate+="/"+dpart.substring(5,7);
        orderdate+="/"+dpart.substring(0,4);
        orderdate+=" "+tpart;
    }
    catch (Exception e)
    {
        Log.d(getString(R.string.app_name), e.getMessage());
    }
    HashMap<String, String> row = new HashMap<String, String>();
    row.put("type", "text");
    row.put("details", "Order ID:"+order_id);
    messageList.add(row);
    HashMap<String, String> rowd = new HashMap<String, String>();
    rowd.put("type", "text");
    rowd.put("details", "Order Date:"+orderdate);
    messageList.add(rowd);
    HashMap<String, String> row1 = new HashMap<String, String>();
    row1.put("type", "text");
    row1.put("details",cust_name);
    messageList.add(row1);
    HashMap<String, String> row2 = new HashMap<String, String>();
    row2.put("type", "text");
    row2.put("details",cust_address);
    messageList.add(row2);
    HashMap<String, String> row3 = new HashMap<String, String>();
    row3.put("type", "text");
    row3.put("details","Pin:"+cust_pincode);
    messageList.add(row3);
    HashMap<String, String> row4 = new HashMap<String, String>();
    row4.put("type", "text");
    row4.put("details","Mob:"+cust_mobile);
    messageList.add(row4);
    HashMap<String, String> row5 = new HashMap<String, String>();
    row5.put("type", "text");
    row5.put("details","mail:"+cust_email);
    messageList.add(row5);
    oa=new OrderDetailsAdapter(mychatorderdetails.this,messageList);
    lv = (ListView) findViewById(R.id.lstOrderDetails);
    lv.setAdapter(oa)

above is my android studio code. All other field i am able to fetch. Only mail and fax field i am unable to fetch. What might be the reason. please help me. First time i am fetching data from mysql to android studio

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 用windows做服务的同志有吗
    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图