Welcome Guest, Not a member yet? Register   Sign In
Why crash my code?
#5

(03-02-2020, 01:42 AM)zahhar Wrote: Hi,

You code is a bit suboptimal. I would check a couple of things:
1) Do you have indexes on cart.user_id field, on product.pid and on user.pid fields?
2) How much records do you expect $carts[] array has? Probably, instead of N separate queries woul be beter to implode() your $cart['prodict_id'] nd get them in one shot using SQL IN() clause?
3) ensure $this->get_category() works quick enough and there is nothing slow inside it?
4) don't use @-signs to supress any messages, as they might be vital for your exercies. remove @s and make sure your code works well without them.
5) side note: preg_match is overkill to check for $user_id. You can easilly go with isset() and (int)$user_id>0 for clarity.

Thank you i try to trace it and let to know you
Reply


Messages In This Thread
Why crash my code? - by omid_student - 03-01-2020, 01:15 AM
RE: Why crash my code? - by jreklund - 03-01-2020, 03:00 AM
RE: Why crash my code? - by omid_student - 03-01-2020, 03:27 AM
RE: Why crash my code? - by zahhar - 03-02-2020, 01:42 AM
RE: Why crash my code? - by omid_student - 03-02-2020, 09:45 AM
RE: Why crash my code? - by tweenietomatoes - 03-02-2020, 12:43 PM
RE: Why crash my code? - by InsiteFX - 03-02-2020, 02:02 PM
RE: Why crash my code? - by omid_student - 03-02-2020, 02:57 PM
RE: Why crash my code? - by nonebeliever - 03-03-2020, 03:26 AM
RE: Why crash my code? - by InsiteFX - 03-03-2020, 04:26 AM
RE: Why crash my code? - by omid_student - 03-03-2020, 05:50 AM
RE: Why crash my code? - by zahhar - 03-04-2020, 04:35 AM
RE: Why crash my code? - by omid_student - 03-04-2020, 05:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB