Lier code PHP avec pugin Theme CSS DataTable

Résolu/Fermé
Pegase_91 Messages postés 10 Date d'inscription mardi 9 février 2016 Statut Membre Dernière intervention 22 février 2016 - Modifié par Pegase_91 le 14/02/2016 à 15:34
Pegase_91 Messages postés 10 Date d'inscription mardi 9 février 2016 Statut Membre Dernière intervention 22 février 2016 - 14 févr. 2016 à 19:14
Bonjour à tous,

Je rencontre actuellement un petit soucis de forme sous php.

Je mexplique :

J'ai crée un tableau de données php lié à ma base de données mysql et je voudrais mettre en forme ce tableau avec un theme jquery.

J'ai donc effectué au préalable les différentes configuations présentes dans le topic -> http://macmicro.chez.com/framework/datatable_config.php

Mon code donne ça :



!DOCTYPE html>
<html>
<head>

<title>Programme du jour</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link href="Styles/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery-2.2.0.js"></script>
<script type="text/javascript" src="jquery.dataTables.min.js"></script>
<script type="text/javascript" src="jquery-ui.min.js"></script>
<link href="jquery-ui.theme.css" rel="stylesheet" type="text/css" />


</head>


<script type="text/javascript" charset="utf-8">
var oTable;
$(document).ready(function() {
oTable = $('#menuTable').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"oLanguage": { "sUrl": "js/fr_FR.txt" },
});
});
</script>



<body>




<?php


include 'DateJour.php';


?>


<?php


$serveur="localhost:8889";
$login="root";
$pass="root";



try{
$connexion=new PDO("mysql:host=$serveur;dbname=pegasedb",$login, $pass, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
$connexion->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);


$courses=$connexion->query("SELECT NUMR, HIPPODROME, NUMC, TITRE, SSPECIALITE, NBPAR FROM courses WHERE DATEC>=CURDATE()
ORDER BY NUMR");
$courses->setFetchMode(PDO::FETCH_OBJ);




}

Catch(PDOException $e){
echo 'echec: '.$e->getMessage();
}

?>

<div style="overflow-x:auto;">

<table class="courses">

<tr class="EnteteP">
<th align="center">N°R</th>
<th align="center">REUNION</th>
<th align="center">N°C</th>
<th align="center">TITRE</th>
<th align="center">DISCIPLINE</th>
<th align="center">PARTANTS</th>
<th align="center">PRONOSTIC</th>
<th align="center">RESULTATS</th>
<th align="center">RAPPORTS</th>
<th align="center">BILAN</th>
</tr>


<?php


While($resultat = $courses->fetch() )

{

?>

<tr>
<td align="center"><?php echo $resultat->NUMR ;?></td>
<td align="left"><?php echo $resultat->HIPPODROME ;?></td>
<td align="center"><?php echo $resultat->NUMC ;?></td>
<td align="left"><?php echo $resultat->TITRE;?></td>
<td align="left"><?php echo $resultat->SSPECIALITE;?></td>
<td align="center"><?php echo $resultat->NBPAR;?></td>
<td align="center"><?php echo "";?></td>
<td align="center"><?php echo "";;?></td>
<td align="center"><?php echo "";?></td>
<td align="center"><?php echo "";?></td>

</tr>



<?php

}

$courses->closeCursor();

?>


</table>
</body>
</html>





J'ai bien un tableau de données qui s'affiche. Cependant il ne correspond en aucun point à celui du thème jquery que j'ai selectionné dans le <head>.

Des idées ?

Merci d'avance.
A voir également:

1 réponse

jordane45 Messages postés 38144 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 21 avril 2024 4 650
14 févr. 2016 à 18:03
Bonjour
cette question concerne le javascript (je déplace le sujet au bon endroit )

Ensuitr...et bien... tu as oublié de mettre un ID a ton tableau....
penses aussi à mettre les thead et le tbody.
0
Pegase_91 Messages postés 10 Date d'inscription mardi 9 février 2016 Statut Membre Dernière intervention 22 février 2016
14 févr. 2016 à 19:14
merci Jordan ça marche !
0