PHP Classes

invalid check

Recommend this page to a friend!

      MySQL V class  >  All threads  >  invalid check  >  (Un) Subscribe thread alerts  
Subject:invalid check
Summary:in the constructor, errors can occur
Messages:1
Author:TwistOneUp
Date:2011-09-12 17:10:17
 

  1. invalid check   Reply   Report abuse  
Picture of TwistOneUp TwistOneUp - 2011-09-12 17:10:17
hi,

overall, the class is nice, but in the constructor you check if the number of parms > 0, then you proceed to assUme that > 0 means = 4, by accessing parms 0, 1, 2, and 3.

if the number of parms supplied was 2, your if will be found true, then the accesses to parm(2) and parm(3) will fail with errors.

instead, why not check the count of parms = 4, if so, go ahead as your code currently does, and if != 4, then perhaps a nice error message?

just an idea. otherwise, the class looks fine, and thanks for publsishing it.

TwistOneUp