Problem finding which row selected

Codes here !

Moderators: macek, egami, gesf

Post Reply
User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Post by Redcircle » Sun Feb 16, 2003 12:47 pm

if you have created your database correctly you should have a primary key. usually 'id' or the sort.

in the 'edit' href you can append the id and have php use the $_GET super global to determine what record you want to edit. example using your sample.

Code: Select all

for ($i=0; $i <$num_results; $i++) 
{
$row = mysql_fetch_array($result);
echo "<tr align='center'><td height='30'><a href='edit.php?record=".$row["id"]."'>edit</a>  <a href='delete.php?record=".$row["id"]."'>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>";
}

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest