Posts by ripsup

4 posts
  • Has been part of the Envato Community for over 5 years
  • Has collected 1+ items on Envato Market
ripsup says

Sorry to complain more about this tutorial but the live demo is pretty pointless after the first couple people delete items. :) Might want to add a repopulate button.

But on a more serious note. Why use jQuery in this case to show off that effect. You are loading there entire library to add the class even to a few rows. This could have been easily added in the loop in the original PHP . This tutorial really goes all over the place and could have been helped by maybe not trying to throw to much in especially when it’s not needed. This could have really done better in having a more solid single message instead of being all over the place.

4 posts
  • Has been part of the Envato Community for over 5 years
  • Has collected 1+ items on Envato Market
ripsup says

People already pointed out some major flaws with this, but also an issue is that you should be doing a Mysql error check with each query you are doing. Maybe you have issues with the first couple of queries and then none with the later ones. You would then not see any of those errors. As well it would be better to do them all in one go so you don’t have to worry about half your deletes working. This also would help reduce the queries going to the database and make things quicker overall.

Another small point, your example seems to be related to items that might be for sale. Most likely you wouldn’t want to delete them as they might be attached to something else in the database (say an invoice) that might still need that information. I run into this a lot with our student programmers who have not quite grasped the interconnection between things in the database or the desire to be able to see things in the past that are no longer needed. In cases like that it is better to have an active/disabled column that you can change instead of deleting the whole item. Deletes are something rarely used by us normally only for linking tables.

And as a double emphasis, please add sanitization even in simple example code. This is something that a lot of people still don’t quite get because they never see it in the examples they look at and is one of the worst security risks you can have.

by
by
by
by
by
by