Alien13
Alien13

Reputation: 618

Recover data after the update in PHPMyAdmin

I ran some bad code on my site which made all the usernames change to the exact same username (ratik513) which was the most recently added username.

$query2 = "UPDATE users SET username='$'"; mysql_query($query);

I don't want any answers concerning what is wrong with this piece of code, I just want to know how to get those usernames back... If it is possible.

Upvotes: 1

Views: 1565

Answers (2)

Rahul Tripathi
Rahul Tripathi

Reputation: 172448

I just want to know how to get those usernames back... If it is possible.

If you have a backup file of your db then you can get the data from that using the restore option of your database else you cant get your data back.

Something like:

SET autocommit = 0;

START TRANSACTION;
  UPDATE ...;

Upvotes: 6

akuzminsky
akuzminsky

Reputation: 2258

In theory, possible. 1. If original username was shorter than ratik513 then Innodb marks the old version of the record as deleted and inserts a new one. 2. Old username along with the PK goes to the undo buffer

Upvotes: 0

Related Questions