Hot answers tagged

3

There are a lot of things wrong with your code, but none of them should cause performance or security issues. The main thing you are doing is you are using prepared statements. Of course, I would highly encourage you to make the switch to PDO as it is easier to use. Some main pain points: Never expose MySQL errors to the user! This is potentially a huge ...


3

Rather than passing the db connection into your constructor, I think it would be cleaner for your constructor to call a method in your DB class which first checks for an existing connection and only creates one if not found. This connection could be fetched by any other method if/when needed. It is best practice to create just one db connection and keep ...


2

jsonProduct["VehicleApplications"].Count() should be outside the iteration, otherwise it will be executed on each iteration which impact the performance. So, you should do : var count = jsonProduct["VehicleApplications"].Count(); for (int i = 0; i < count; i++) { var vehicleApp = jsonProduct["VehicleApplications"][i]; ...


Only top voted, non community-wiki answers of a minimum length are eligible