我最近买了项目管理系统,我试图添加新表格,但我的表格不起作用。我认为我的问题是模型,我无法获得提交给数据库的会话值(project_code),以确保特定项目对特定条目可见。我买的系统是在codecanyon上可用的。
模型
function client_invoicing_add($project_code = '') {
//$data['project_code'] = $project_code;
//$data['project_code'] = $this->session->userdata('project_code');
$data['client_payment_milestone'] = $this->input->post('client_payment_milestone');
$data['client_payment_deliverables'] = $this->input->post('client_payment_deliverables');
$data['client_payment_date'] = $this->input->post('client_payment_date');
$data['client_payment_amount'] = $this->input->post('client_payment_amount');
$data['timestamp'] = strtotime($this->input->post('timestamp'));
$data['client_id'] = $this->session->userdata('login_user_id');
$data['project_code'] = $this->db->get_where('project' , array('project_id' => $project_id))->row()->project_code;
//$data['project_id'] = $this->db->get_where('project' , array('project_code' => $project_code))->row()->project_id;
$this->db->insert('client_invoicing' , $data);
}
控制器
// Client invoicing
function client_invoicing($param1 = '' , $param2 = '' , $param3 = '') {
if ($this->session->userdata('client_login') != 1) {
$this->session->set_userdata('last_page', current_url());
redirect(base_url(), 'refresh');
}
if ($param1 == 'add') {
$this->crud_model->client_invoicing_add($param2); // param2 = project code
}
if ($param1 == 'edit') {
$this->crud_model->client_invoicing_edit($param2); // param2 = client payment id
}
if ($param1 == 'delete') {
$this->crud_model->client_invoicing_delete($param2); // param2 = client payment id
}
}
答案 0 :(得分:0)
您可以使用var_dump($this->session->all_userdata());
打印所有会话对象。从中他们可以检查会话是否已设置。
答案 1 :(得分:0)
This is the code which I am using:
<?php include("config.php");
include("session-user.php");
if(isset($_POST['search']) && $_POST['search'] != "") {
$searchq = $_POST['search'];
$searchq = preg_replace("#[^0-9a-z]#i","",$searchq);
$query = "SELECT * FROM tbl_product WHERE product_title LIKE '%$searchq%' and is_delete = '0'";
$sql=mysqli_query($con,$query);
$count = mysqli_num_rows($sql);
while($row = mysqli_fetch_array($sql)){
$product_title = $row['product_title'];
$id = $row['product_id'];}?>
<script>
window.location="product.php?pid=<?php echo $id?>";
</script>
<?php
}
?>
<div class="ui-widget">
<input id="automplete-3" type="text" class="form-control" placeholder="Search" name="search">
</div>
注意:如果您正在尝试的项目,userdata()方法将返回NULL 访问不存在。