se intendi quando usi la funzione giacenza, allora dovresti passarli l'ID a quella funzione.
una cosa tipo questa:
Codice PHP:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Index</title>
<link href="index.css" rel="stylesheet" type="text/css">
<link href="modellocss.css" rel="stylesheet" type="text/css">
<script src="finale.js"></script>
</head>
<body bgcolor="#06B3E8">
<div class="intestazione" id="intestazione">
<ul class="sopra" id="sopra">
<li class="home" id="home"> <a href="Index.php">Home</a></li>
<li class="prodotti" id="prodotti"> <a href="casda">Prodotti</a></li>
<li class="lavora" id="lavora"> <a href="casda">Lavorazione</a></li>
</ul>
</div>
<div class="visualizzazione" id="visualizzazione">
<?php
$data = 'sito';
$db = mysqli_connect('localhost', 'root', '', $data);
$result = mysqli_query($db, "SELECT * FROM prodotti");
echo"<table id='tabella' width='800' border='1'>";
echo"<tr>
<th >Codice</th>
<th >Nome</th>
<th >Giacenza</th>
<th> Azioni </th>
<th >Data consegna</th>
</tr>";
while ($row = mysqli_fetch_array($result)) {
echo"<tr>
<td id='cod'>" . $row['Codice'] . "</td>
<td id='nom'>" . $row['Nome'] . "</td>
<td id='gia'>" . $row['Giacenza'] . "</td>
<td id='dat'>
<button id='pulsante' onClick='giacenza(" . $row['ID_UNIVOCO'] . ")'>pulsante</button>
</td>
<td id='datac'>";
$dat = $row['Data consegna'];
$data = substr($dat, 8, 2) . "-" . substr($dat, 5, 2) . "-" . substr($dat, 0, 4);
echo $data . "</td>
</tr>";
}
echo"</table>";
?>
</div>
</body>
</html>
ovviamente dovresti modificare la funzione giacenza aggiungendo il parametro da raccogliere.