hello all, can anyone tell me how to update a particular row or delete a row when none of the fields are a primary key? i mean the records are displayed using html table format now when i want to update a particular row from the table i always get the last row updated why is that so? i guess the problem is in storing the data in array how do i check the values stored in array with the values i have selected the row for updation and then store the new values. same way how do i delete a particular row? i have provided checkbox for each row and the user can check that to delete that row but it so happens immaterial of whatever box is checked always the last row entry gets deleted. how do i solve? please helpme Regards Roopa
What you can do is add-ing a primary key in an hidden entry (INPUT TYPE=hidden NAME=primarykey VALUE=\"$primkey\"> ans use this in your update key than you can't have any problems :-)
Gr.
Kasper
hello , Will u be more clear on this? u mean i should have a field in the db table with primary key or what is it? i cannot make any of the fields in the table a primary key taht's my specification. Any help appreciated Roopa
Means add a new column in the table in which you put a primary key.
If there's no way of uniquely specifying which row you want deleted or updated, using only information in the table, then you will continue to have this problem.
...Unless you know that there's a distinguishing field(s) by which you can identify that record, in which case you'd put a WHERE clause to the query.
That is what I meant by "only information in the table" 🙂
Without more information from Roopa about the database structure and how rows are supposed to be identified in the first place, help can't be much more forthcoming.