Bonjour,
J'ai bien vérifier mais il n'y a aucun $hS1.
La récupération est le même non, même si c'est avec les frameworks?
Bonjour,
J'ai bien vérifier mais il n'y a aucun $hS1.
La récupération est le même non, même si c'est avec les frameworks?
Si tu as un message d'erreur qui parle d'une variable hS1, c'est qu'elle est mentionnée dans ton code, PHP ne l'invente pas.
Bonjour,
voila mon code:
1)en modèle
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66 <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Pointage_model extends CI_Model { public $table = 'pointage'; public $id = 'idP'; public $order = 'DESC'; function __construct() { parent::__construct(); } // get all function get_all() { $this->db->order_by($this->id, $this->order); return $this->db->get($this->table)->result(); } // get data by id function get_by_id($id) { $this->db->where($this->id, $id); return $this->db->get($this->table)->row(); } // get total rows function total_rows($q = NULL) { $this->db->like('idP', $q); $this->db->or_like('matricule', $q); $this->db->or_like('nom', $q); $this->db->or_like('groupe', $q); $this->db->or_like('date1', $q); $this->db->or_like('date2', $q); $this->db->or_like('hE1', $q); $this->db->or_like('hS1', $q); $this->db->or_like('hN1', $q); $this->db->or_like('hSup1', $q); $this->db->from($this->table); return $this->db->count_all_results(); } // get data with limit and search function get_limit_data($limit, $start = 0, $q = NULL) { $this->db->order_by($this->id, $this->order); $this->db->like('idP', $q); $this->db->or_like('matricule', $q); $this->db->or_like('nom', $q); $this->db->or_like('groupe', $q); $this->db->or_like('date1', $q); $this->db->or_like('date2', $q); $this->db->or_like('hE1', $q); $this->db->or_like('hS1', $q); $this->db->or_like('hN1', $q); $this->db->or_like('hSup1', $q); function insert($data) { $this->db->insert($this->table, $data); }
2) en vue
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80 <!doctype html> <html> <head> <title>harviacode.com - codeigniter crud generator</title> <link rel="stylesheet" href="<?php echo base_url('assets/bootstrap/css/bootstrap.min.css') ?>"/> <link rel="stylesheet" href="<?php echo base_url('assets/datatables/dataTables.bootstrap.css') ?>"/> <style> body{ padding: 15px; } </style> </head> <body> <div class="row" style="margin-bottom: 10px"> <div class="col-md-4"> <h2 style="margin-top:0px">Pointage List</h2> </div> <div class="col-md-4 text-center"> <div style="margin-top: 4px" id="message"> <?php echo $this->session->userdata('message') <> '' ? $this->session->userdata('message') : ''; ?> </div> </div> <div class="col-md-4 text-right"> <?php echo anchor(site_url('pointage/create'), 'Create', 'class="btn btn-primary"'); ?> <?php echo anchor(site_url('pointage/excel'), 'Excel', 'class="btn btn-primary"'); ?> <?php echo anchor(site_url('pointage/word'), 'Word', 'class="btn btn-primary"'); ?> </div> </div> <table class="table table-bordered table-striped" id="mytable"> <thead> <tr> <th width="80px">No</th> <th>Matricule</th> <th>Nom</th> <th>Groupe</th> <th>Date1</th> <th>Date2</th> <th>HE1</th> <th>HS1</th> <th>HN1</th> <th>HSup1</th> </thead> <tbody> <?php $start = 0; foreach ($pointage_data as $pointage) { ?> <tr> <td><?php echo ++$start ?></td> <td><?php echo $pointage->matricule ?></td> <td><?php echo $pointage->nom ?></td> <td><?php echo $pointage->groupe ?></td> <td><?php echo $pointage->date1 ?></td> <td><?php echo $pointage->date2 ?></td> <td><?php echo $pointage->hE1?></td> <td><?php echo $pointage->hS1?></td> <td><?php echo $pointage->hN1; echo date_create_from_format('H\hi', $_POST['hS1'])->diff(date_create_from_format('H\hi', $_POST['hE1']))->format('%hh%I');?></td> <td><?php echo $pointage->hSup1 ?></td> </td> </tr> <?php } ?> </tbody> </table> <script src="<?php echo base_url('assets/js/jquery-1.11.2.min.js') ?>"></script> <script src="<?php echo base_url('assets/datatables/jquery.dataTables.js') ?>"></script> <script src="<?php echo base_url('assets/datatables/dataTables.bootstrap.js') ?>"></script> <script type="text/javascript"> $(document).ready(function () { $("#mytable").dataTable(); }); </script> </body> </html>
et 3) en controller
Et c'est sur la vue en ligne 92 qu'il y a erreur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100 <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Pointage extends CI_Controller { function __construct() { parent::__construct(); $this->load->model('Pointage_model'); $this->load->library('form_validation'); } public function index() { $pointage = $this->Pointage_model->get_all(); $data = array( 'pointage_data' => $pointage ); $this->load->view('pointage/pointage_list', $data); } public function read($id) { $row = $this->Pointage_model->get_by_id($id); if ($row) { $data = array( 'idP' => $row->idP, 'matricule' => $row->matricule, 'nom' => $row->nom, 'groupe' => $row->groupe, 'date1' => $row->date1, 'date2' => $row->date2, 'hE1' => $row->hE1, 'hS1' => $row->hS1, 'hN1' => $row->hN1, 'hSup1' => $row->hSup1, ); $this->load->view('pointage/pointage_read', $data); } else { $this->session->set_flashdata('message', 'Record Not Found'); redirect(site_url('pointage')); } } public function create() { $data = array( 'button' => 'Create', 'action' => site_url('pointage/create_action'), 'idP' => set_value('idP'), 'matricule' => set_value('matricule'), 'nom' => set_value('nom'), 'groupe' => set_value('groupe'), 'date1' => set_value('date1'), 'date2' => set_value('date2'), 'hE1' => set_value('hE1'), 'hS1' => set_value('hS1'), 'hSup1' => set_value('hSup1'), 'tHSup' => set_value('tHSup'), ); $this->load->view('pointage/pointage_form', $data); } public function create_action() { $this->_rules(); if ($this->form_validation->run() == FALSE) { $this->create(); } else { $data = array( 'matricule' => $this->input->post('matricule',TRUE), 'nom' => $this->input->post('nom',TRUE), 'groupe' => $this->input->post('groupe',TRUE), 'date1' => $this->input->post('date1',TRUE), 'date2' => $this->input->post('date2',TRUE), 'hE1' => $this->input->post('hE1',TRUE), 'hS1' => $this->input->post('hS1',TRUE), 'hSup1' => $this->input->post('hSup1',TRUE), ); $this->Pointage_model->insert($data); $this->session->set_flashdata('message', 'Create Record Success'); redirect(site_url('pointage')); } }
Dois-je déplacer mon code ou le modifier?
Merci!
Vous avez un bloqueur de publicités installé.
Le Club Developpez.com n'affiche que des publicités IT, discrètes et non intrusives.
Afin que nous puissions continuer à vous fournir gratuitement du contenu de qualité, merci de nous soutenir en désactivant votre bloqueur de publicités sur Developpez.com.
Partager