John Davidson

php - showing bata in persnalize datatable

0 comments
Message:


*I have in my model there function, all this function is used for displaying the frequence of travel ''voyage'' of trucks ''camion'', the code work but my problem is about the view in codeigniter, i would like to show the result of my requete like in the image



function display_frequenceVoyageTrajet()
{
$query=$this->db->query("SELECT trajet_Voyage, imm_Camion,year(dateBL_Voyage) AS Year, CASE month(dateBL_Voyage)
WHEN 1 THEN 'Janvier'
WHEN 2 THEN 'Fevrier'
WHEN 3 THEN 'Mars'
WHEN 4 THEN 'Avril'
WHEN 5 THEN 'Mai'
WHEN 6 THEN 'Juin'
WHEN 7 THEN 'Juillet'
WHEN 8 THEN 'Août'
WHEN 9 THEN 'Steptembre'
WHEN 10 THEN 'Octobre'
WHEN 11 THEN 'Novembre'
WHEN 12 THEN 'Decembre'
END AS `monthname`,MONTH(dateBL_Voyage) `month`, COUNT(*) as frequence FROM voyage GROUP BY trajet_Voyage,imm_Camion,year(dateBL_Voyage), DATE_FORMAT(`dateBL_Voyage`, '%M') ORDER BY MONTH(dateBL_Voyage),year(dateBL_Voyage)");
return $query->result();}





function display_frequenceVoyageTrajet1()
{
$query1=$this->db->query("SELECT imm_Camion FROM camion");
return $query1->result();
}





function display_frequenceVoyageTrajet2()
{
$query2=$this->db->query("SELECT COUNT(*) as total FROM camion");
return $query2->result();
}


My Answer:
>db->query("SELECT camion, COUNT(voyage) as frequence FROM trajet GROUP BY camion");
return $query->result();
}__

In your view file in CodeIgniter, you can loop through the results of the query and display them in a table format. Here's an example of how you can do this:

html















Camion Frequence
camion; ?> frequence; ?>



Make sure to pass the result of the `display_frequenceVoyageTrajet()` function to your view file and assign it to a variable like `$frequence_voyages`. Then, you can use this variable in the loop to display the data in the table.

Rate this post

5 of 5 based on 4602 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us