Hi, I have a problem with deleting an entry from mysql table. whenever I click the delete button it deletes the last entry from my table and not the one that I've chosen.
here is the codes
and the delete code
help anyone .., Thank You in advance
/>
here is the codes
echo "<font face='Arial' size='1'>"; $conn=mysql_connect("localhost","root",""); if(!$conn) { die('could not connect!' . mysql_error()); } mysql_select_db("people", $conn); $result=mysql_query("select * from usersinfo"); echo "<table border='1' align='center'> <tr> <th> </th> <th> username</th> <th> password </th> <th> action </th> </tr>"; while ($row=mysql_fetch_array($result)) { echo "<tr>"; echo "<td>"; echo " <input type='checkbox' value='check'> "; echo "</td>"; echo "<td>" . $row['USERNAME'] . "</td>"; echo "<td>" . $row['LASTNAME'] . "</td>"; echo "<td>" . $row['FIRSTNAME'] . "</td>"; echo "<td>" . $row['MI'] . "</td>"; echo "<td>" . $row['COMPANY'] . "</td>"; echo "<td>" . $row['POSITION'] . "</td>"; echo "<td>" . $row['DEPARTMENT'] . "</td>"; echo "<td>"; echo "<form method='post' action='ADD.php'>"; echo "<input type='hidden' name='ACE_id' value=". $row['ID'] .">"; echo "<input type='submit'>"; echo "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($conn); echo "</td>"; ]
and the delete code
<?php function del_userinfo( ) { $DELid=$_POST["ACE_id"]; $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("people", $con); mysql_query("DELETE FROM usersinfo WHERE ID='" . $DELid . "'"); mysql_close($con); } ?>
help anyone .., Thank You in advance
