Kirk Babb wrote:
Here's a part of my code, which is retrieving player records from mysql
and displaying them in a table:

-----------------------------------------
if($queryChk3 !== 0){
        print("<form action='$_SERVER['PHP_SELF']' method='POST'>
          <input type='hidden' name='teamID' value='$teamID'>
          <input type='hidden' name='pwd' value='$pwd'>
          <table border='1'><tr>
            <td colspan='7'><b>Player Roster for $teamName</b></td></tr>
            <tr><td><b>Last Name</b></td><td><b>First Name</b></td>
            <td><b>DOB</b></td><td><b>Telephone</b></td>
            <td><b>Address</b></td><td><b>Email</b></td>
            <td><b>Sex</b></td></tr>");
        while($row = mysql_fetch_array($query3)) {
          print("<tr>");
          $lname   = $row['lname'];
          $fname   = $row['fname'];
          $dob     = $row['dob'];
          $phone   = $row['phone'];
          $address = $row['address'];
          $email   = $row['email'];
          $sex     = $row['sex'];

You coulds do away with the above and replace with


while (list($firstname, $lastname.. etc) = mysql_fetch_row($sql_query)) {
   echo "$firstname $lastname<br>\n";
}


          print("<td>" . $lname . "</td><td>" . $fname . "</td><td>"
          . $dob . "</td><td>" . $phone . "</td><td>" . $address

or instead code as echo "<td>" . $row['lname'] . "</td><td>" . $row['fname'] . "</td><td>"

. "</td><td>" . $email . "</td><td>" . $sex . "</td>");
print("</tr>");
}
print("</table><input type='submit' name='Submit'></form>");
} ------------------------------------------


I'd like to add buttons to "edit this record" and "delete this record" to each row but I'm not sure how to get it done. It seems like I'd have
to add a hidden variable (playerID, which is my primary key for the table
"players") to each row printed but how do I manage unique "submits" since
I'm already inside a form? I must be missing something obvious - please help!

Get the ID field from DB and put a link in as echo '<tr><td><a href="edit.page?ID=".$row['id'].">'

have fun

Thanks,


Kirk

-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to