Im new to php/mysql so my question might sound pretty basic. I want php to look in my database and list all the values of a table in a web interface im creating. The code I use to diplay the rows is shown as follows:
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
echo "<tr align='center'><td height='30'><a href='edit.php'>edit</a> <a href='delete.php'>delete</a></td><td>";
echo htmlspecialchars( stripslashes($row["class_name"]));
echo "</td><td>";
echo htmlspecialchars( stripslashes($row["class_date"]));
echo "</td><td>";
echo htmlspecialchars (stripslashes($row["name"]));
echo "</td><td>";
echo htmlspecialchars (stripslashes($row["email"]));
echo "</td><td>";
echo htmlspecialchars (stripslashes($row["company"]));
echo "</td><td>";
echo htmlspecialchars (stripslashes($row["position"]));
echo "</td><td>";
echo htmlspecialchars (stripslashes($row["phone"]));
echo "</td><td>";
echo htmlspecialchars (stripslashes($row["city"]));
echo "</td><td>";
echo htmlspecialchars (stripslashes($row["state"]));
echo "</td><td>";
echo htmlspecialchars (stripslashes($row["zip_code"]));
echo "</td><td>";
echo htmlspecialchars (stripslashes($row["comments"]));
echo "</td></tr>";
}
The problem is that I want a "delete/edit" option for each row, in the form of a link (similar to the phpmyadmin table viewing page). I have no idea how to figure out how to tell which row the user selects the "edit/delete" link from. Im not sure how clear this explanation is, but if anyone could help me I would gladly appreciate it. Thank you 🙂