co.ador Posted July 21, 2009 Share Posted July 21, 2009 Notice: Undefined variable: classes in C:\wamp\www\shoes\stores\classes\rating.class.php on line 160 private static function ShowStars($varStars) { // Select the Number of Stars Class switch ($varStars) { case 1: $classes .= "onestar"; break; case 2: $classes .= "twostar"; break; case 3: $classes .= "threestar"; break; case 4: $classes .= "fourstar"; break; case 5: $classes .= "fivestar"; // line 160 break; default: $classes .= "nostar"; break; } return $classes; } Quote Link to comment Share on other sites More sharing options...
TomNomNom Posted July 21, 2009 Share Posted July 21, 2009 Hi there :-) You are trying to append to the variable $classes before it has been initialised. Either change the append operators to assignment operators (.= becomes =), or initialise the variable before the start of the switch statement ($classes = ''; ). IMO, the first idea makes more sense as there is no reason to be appending to $classes in this case as it contains no data to begin with. Quote Link to comment Share on other sites More sharing options...
co.ador Posted July 21, 2009 Author Share Posted July 21, 2009 Problem solved I tried both method worked. 1- changing the append operators to assignment operators 2- and initializing the variable. I initialized the $classes=''; inside the switch statement and it didn't worked then I tried outside and it did worked. Then I read your post and I realized you stated to initialized before the star switch statement. hard head thank bro.. Problem solved... Hey don't forget to initialise is written with an z Lol.... Quote Link to comment Share on other sites More sharing options...
TomNomNom Posted July 22, 2009 Share Posted July 22, 2009 Glad I could be of service Hey don't forget to initialise is written with an z Lol.... Not in Britain it ain't ;-) Quote Link to comment Share on other sites More sharing options...
co.ador Posted July 22, 2009 Author Share Posted July 22, 2009 O Well! Languages! Quote Link to comment Share on other sites More sharing options...
co.ador Posted July 22, 2009 Author Share Posted July 22, 2009 Thank you I just bugging around! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.