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
|
<html>
<head>
<link rel="STYLESHEET" type="text/css" href="style.css" />
<meta charset="utf-8" />
<?php
include('conf.php');
include('func_list.php');
?>
<script type="text/javascript" src="jquery.js"></script>
<script>
$(document).ready(function()
{
$("td").click(function()
{
if( $(this).attr("contenteditable") == "true")
{
var contenu_avant = $(this).text();
var id_bdd = $(this).attr("id");
var champ_bdd = $(this).attr("name");
//alert("avant =" + contenu_avant);
$(this).blur(function()
{
var contenu_apres = $(this).text();
//alert("contenu apres = " + contenu_apres);
if (contenu_avant != contenu_apres)
{
parametre='id='+id_bdd+'&champ='+champ_bdd+'&contenu='+contenu_apres ;
//walert(param) ;
$.ajax({
url: "update.php",
type: "POST",
data: parametre,
success: function(html) {
//alert(html);
}
});
}
});
};
});
});
</script>
</head>
<body>
<?php
echo '<table><tr><td><center>Article</center></td><td><center>Quantité</center></td></tr>';
mysql_connect($server, $login, $pass) or die(mysql_error());
mysql_select_db($bdd)or die("Impossible de se connecter à la base de données");
$requete = mysql_query("SELECT * FROM `db_materiel` ") or die (mysql_error());
while ($ligne1 = mysql_fetch_object($requete)){
echo '<tr><td>'.$ligne1->designation_materiel.'</td><td contenteditable="true" style="text-align:right;" id="1" name="quantite_materiel" >'.$ligne1->quantite_materiel.'</td></tr>';
}
mysql_close();
echo '</table>';
?>
</table>
</body>
</html> |
Partager