Cannot edit multiple rows at the same time

Issue #4 resolved
Dane Iracleous created an issue

Originally reported on Google Code with ID 4 ``` It is currently possible to select multiple rows via checkbox and then delete all of them in one click, but the drop down menu containing the available actions to perform is missing the "edit" item. Only the "delete" item is currently available.

phpMyAdmin features the ability to edit multiple rows at the same time, but this enhancement is difficult to implement in phpLiteAdmin, and a viable strategy has not been developed yet. It may be included in a future release.

```

Reported by `diracleo` on 2011-03-06 19:12:08

Comments (2)

  1. Former user Account Deleted

    ``` phpLiterAdmin has this feature.

    For an example of how this was implemented (I looked at how phpMyAdmin did it), go to a database with a table and data, and on the page where data is displayed, right click the page and view the source, and find where the data is being displayed.

    You will see that for each column of each row, there is a hidden input containing the data for that row, so:

    <input type="hidden" name="column[{row}][{column}]" value="{value of the column in that row" />

    Once you go to submit the request, all the data corresponding to the rows selected, will be displayed in the form for editing (you will have inputs that contain the current data that they can edit, AND you will have hidden inputs containing the original values, for later use).

    Once the data is edited, the data will be updated.

    This is where it gets tricky... Some tables have unique keys or primary keys, if they do, you will want to use the data in the WHERE clause in the UPDATE, because those indicate that those columns are unique (of course).

    Example: member_id INT PRIMARY KEY member_name VARCHAR(40) NOT NULL member_pass VARCHAR(40) NOT NULL

    Row data: 1, dane, blah 2, ian, blah

    If we are editing the row with id #2, the update will look like this: UPDATE thetable SET member_id = 2, member_name = 'new value', member_pass = 'blah' WHERE member_id = 2

    If there were no primary or unique key(s), the update will look like this: UPDATE thetable SET member_id = 2, member_name = 'new value', member_pass = 'blah' WHERE member_id = 2 AND member_name = 'ian' AND member_pass = 'blah'

    Hopefully that makes sense... Kind of confusing to try and communicate it with just text.

    As always, feel free to take a look at the phpLiterAdmin source and take anything you need from there (if you are like me, the code itself will be much more explanatory!). ```

    Reported by `ian.aldrighetti` on 2011-03-07 22:13:30

  2. Dane Iracleous reporter

    ``` This feature has been implemented as of v1.5 ```

    Reported by `diracleo` on 2011-03-14 02:27:32 - Status changed: `Fixed`

  3. Log in to comment