I am a working on a dynamic table that communicates with a database (MySQL) where I can query results and such. In this table it works as a sort of "progress page" that shows test-results for certain test-cases on some products. However I am a co-op student and this is my first time working with PHP (and Javascript but I need help with the PHP part of things I guess?..) and in the table I created I have each row that is displayed to automatically have a button created beside it so that I can use that button to edit that particular row. The tricky part is I do not know how to make that button to be individual to a specific row and not end up changing the entire tables results (instead of being independent to that row it is with). I am not even sure I am explaining it correctly but I hope so. Basically this button works as an "edit" button so that it prompts an edit screen where you can change a row's results (and it will take your new added information and query it into the database).
Now I will provide a sort of scenario that will give you a better idea of how I want this to work...
Here is the code of my creation of the button.So let us assume that there is 4 rows of data in the database and the table outputs these 4 rows, well if I add 40 more rows of data into the database the table will now output (upon a refresh of the html page) 44 rows. So I need the "edit" button to be dynamic so that it has a single relationship with the row it is in
Code: Select all
<?php
## Display Table and database results
while($results = mysql_fetch_array($build_device_test)){
echo"<tr>";
echo "<td class='side' >".$results['version']."</td>";
echo "<td class='CBundle' >" .$results['bundle']."</td>";
echo "<td class='CDevice' >".$results['devicename']."</td>";
echo "<td class='CJava' ></td>";
echo "<td class='CMMS' ></td>";
echo "<td class='CBranch' ></td>";
echo "<td class='CJC' ></td>";
echo "<td class='selection' ><button type='button' onclick='disp_prompt()'>Edit</button></td>";
/* I am creating the button for each row that is displayed on the table, and the disp_prompt is a basic login javascript thing I did based on alert box for the sake of seeing how to make it work. */
echo"</tr>";
}
echo"</tbody>";
echo"</table>";
?>I cannot disclose any specific information as these test cases are sensitive upon release (for the companies...and my job's sake) and I apologize for the length of this post or the difficulty of this problem.
Thank you,
Manny