douhoushou8385 2015-09-30 07:44
浏览 34


I have three users Admin,Reseller and Users. Now Reseller request to admin that he want XYX number of users.

This is saved in a table called User_request Now in admin there is a view where he can see which reseller has requested how many users.

And there is a button Approve or Reject. If Admin hits approve then I want my code to create that much users for that reseller. Now each users is mapped to his/her reseller by a field called key which is unique.

So, when users is created it must store the key of reseller in users table.

Add Users

Now, if approves users that request by re-seller must be deleted. I am very confused what I should be doing here!

The View :

  <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-info">
                    <div class="panel-heading">
                      <h4>New User Requests</h4>
                    <!-- /.panel-heading -->
                    <div class="panel-body">
                        <div class="dataTable_wrapper">
                            <table class="table table-striped table-bordered table-hover" id="dataTables-example">

                                        <th>Users Requested</th>
                                        <th>Unique Id</th>
                                        <th>Date Of Request</th>

                               <!-- This is where we fetch all records-->


                                <?php if(count($users)): foreach($users as $user): ?>

                                    <tr class="odd gradeX">
                                        <td><?php echo  $user->id; ?></td>
                                        <td><?php echo $user->id, $user->user_requested; ?></td>
                                        <td><?php echo $user->id, $user->key; ?></td>
                                        <td><?php echo $user->id, $user->date_requested; ?></td>
                                        <td><a href="reseller/create_user" class="btn btn-primary">Yes&nbsp<i class="glyphicon glyphicon-ok"></i></a></td>
                                        <td><a href="reseller/change_status" class="btn btn-danger">No&nbsp<?php echo'<i class="glyphicon glyphicon-trash"></i>';?></a></td>
                                         <td><a href="" class="btn btn-success"><?php echo  $user->status; ?></td>&nbsp</a></td>


                                    <?php endforeach; ?>
                                    <?php else: ?>
                                            <td colspan="3">We could not find any users.</td>
                                    <?php endif; ?> 

                        <!-- /.table-responsive -->

                    <!-- /.panel-body -->
                <!-- /.panel -->
            <!-- /.col-lg-12 -->

The Controller:

      public function create_user()


        $id = $this->session->userdata('id');

            $this->db->set('status', "'approved'",FALSE);



Now, I just want to add the code to creates users for the requested Reseller.

  • 写回答

1条回答 默认 最新

  • dongyi6845 2015-09-30 11:37

    I have succeeded to accomplish this :

          public function create_user()
                $id= $this->session->userdata('id');
                $rajan =$this->more_m->get(array('user_requested',$id));
                if($query->num_rows() > 0)
                    $row = $query->row_array();
                    $key= $row['key'];
                        for($i=1; $i<=$request;$i++)
                $id = $this->session->userdata('id');
                $this->db->set('status', "'approved'",FALSE);

    Firstly I fetch how many users are required then the key and finally loop them and insert the users along with reseller key

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 如何用matlab实现PSO算法与两种智能优化算法在30维和50维问题上的性能比较?
  • ¥15 在qt的QGraphicsView和QGraphicsScene中遇到的问题
  • ¥50 如何完美解决谷歌礼品卡支付不被检测
  • ¥15 nslt的可用模型,或者其他可以进行推理的现有模型
  • ¥15 arduino上连sim900a实现连接mqtt服务器
  • ¥15 vncviewer7.0安装后如何正确注册License许可证,激活使用
  • ¥15 phython如何实现以下功能?查找同一用户名的消费金额合并2
  • ¥66 关于人体营养与饮食规划的线性规划模型
  • ¥15 基于深度学习的快递面单识别系统
  • ¥15 Multisim仿真设计地铁到站提醒电路