Affichage du contenu d'une table
Bonjour,
Je débute en Php, php jquery Mysql
Je tente de realiser une petite application en Php (en utilisant jquery datatable) afin de gerer une liste d'employes mais je n'arrive pas obtenir ce que je veux avec ma page "liste_emplyes" dont voici le code :
Sur le serveur, j'ai un dossier qui contient les dossiers (js, images, css, admin) et dans le dossier js j'ai
jquery-1.8.0.min.js
jquery.dataTables.js
jquery-ui-1.8.23.custom.min.js
Code:
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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
<?php require_once('Connections/ma_connection.php'); ?>
<?php require_once('security.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_ma_connection, $ma_connection);
$query_RsListe = "SELECT * FROM employes2";
$RsListe = mysql_query($query_RsListe, $ma_connection) or die(mysql_error());
$row_RsListe = mysql_fetch_assoc($RsListe);
$totalRows_RsListe = mysql_num_rows($RsListe);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Liste des employés</title>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<link href="../css/cupertino/jquery-ui-1.8.23.custom.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="../js/jquery.dataTables.js"></script>
<script type="text/javascript" src="../js/jquery-ui-1.8.23.custom.min.js"></script>
<script type="text/javascript" charset="utf-8">
var oTable;
$(document).ready(function() {
$Table = $('#menuTable').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"oLanguage": { "sUrl": "../js/fr_FR.txt" },
"bAutoWidth": false,
"aoColumnDefs": [
{ "asSorting": [ "desc" ], "aTargets": [ 0 ] }
]
});
});
</script>
</head>
<body>
<div id="wrapper">
<div id="header"><span>ADMINISTRATION DES EMPLOYES</span></div>
<div id="navigation">
<a href="liste_employes.php">Liste des employés</a> | <a href="ajout_employes.php">Ajouter un employés</a> | <a href="logout.php">Déconnexion</a>
</div>
<div id="container">
<p id="ptitle">Liste des employés</p>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="display" id="menuTable">
<thead>
<tr>
<th>ID</th>
<th>Matricule</th>
<th>Nom</th>
<th>Service</th>
<th>Poste</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr>
<?php do { ?>
<td><?php echo $row_RsListe['id']; ?></td>
<td><?php echo $row_RsListe['MAT']; ?></td>
<td><?php echo $row_RsListe['NOM']; ?></td>
<td><?php echo $row_RsListe['SRV']; ?></td>
<td><?php echo $row_RsListe['POSTE']; ?></td>
<td align="center"><img src="../images/edit.gif" width="16" height="16" alt="Edition" /> <img src="../images/delete.gif" width="16" height="16" alt="Supprimer" /></td>
<?php } while ($row_RsListe = mysql_fetch_assoc($RsListe)); ?>
</tr>
</tbody>
<tfoot>
<tr><th colspan="6"> </th></tr>
</tfoot>
</table>
</div>
<div id="footer">
<p>développement</p>
</div>
</div>
</body>
</html>
<?php
mysql_free_result($RsListe);
?> |
Je souhaiterais afficher le contenu d'une table (liste d'employes : id, nom, poste, ... avec utilisation de jquery datatable pour avoir un tableau avec des entete de colones avec des petites fleches permettant le classa*ment croissant et decroissant) or le tableau n'(affiche pas les fleches et il affiche une seule ligne sur laquel se succede l'ensemble des données de la table a la place d'une ligne par enregistrement.
Quelqu'un aurait il une idée, une remarque ? SVP Merci
Bonne journée
Raphael