Bet this happened because you just reinstalled WAMP, right? This happens if you did not back up the data folder under MySQL folder.

I am not sure if there is another alternative other than if your Windows backup is running. If it is, then you are lucky.

Simply go to the data folder and look for the iblog0 and ibdata files. Right click, select restore and choose which restore point you wish to revert back.

That’s it!

If Windows was not able to back up those files, you are out of luck.

Good thing MySQL has the IF() function that enables us to update a column by switching values to 0 if current value is 1 and vice versa in just 1 query.

This way, we do not have to waste resources by querying for the current value and then executing an update query.

Setting the sort order between 2 rows in MySQL can be done in 1 line by making use of the IF() function.

I had a scenario where I had move up and move down functionalities to set the order of my database entries.

Let us say, you have columns ID and SORT_ORDER.

This line of code should do the trick.

Related Posts Plugin for WordPress, Blogger...