I want to make a table of comparison of goods on php for this go I want to write down the ID for which he clicked and compare them then so the problem is that the cycle in the script processes all the IDs. Or just help first
<? $stmt = $pdo->query('SELECT DISTINCT id FROM users'); $i = 0; while ($row = $stmt->fetch()) if(++$i >1) break; { ?> <script> $(document).ready(function() { $( "button" ).click(function() { $( "#basket" ).show( "slow" ); var ID = '<?php echo $row['id']; ?>'; $.ajax({ url: "myscript.php", data: {id: ID}, type: "POST", }) .done(function( data ) {}); }); }); </script> <? } ?>