Ok, i'm new to php and work for a place that wants to use php for some web things. My boss learned that I have multiple coding experience and his bright idea was to get me to do some stuff for him, so he bought Zend Studio and gave it to me. Since I know nothing, (i'm currently a photographer.. yeah..) I have some questions about Zend and php in general.

I am working on making our cart run faster and be more efficient, it's fairly simple. When I run the Code Analyzer (b/c i'm lazy) it comes back with all kinds of crap. One of which is "variable $line is used before it is defined" My dumb question being, How do I define this variable?

Currently the code reads:

while ($line == mysql_fetch_row($result)) {
		$CartCount = $line[0];

what can I say, i'm new...

thanks,
adam

    Well, I guess you could do a

    $line=array();

    before your while statement. Seem trivial though...

      Or maybe fix the code.

      while ($line = mysql_fetch_row($result)) { 
      

      You had an extra = in there which probably caused the entire block to be skipped. The Analizer knew there was a problem but did not express itself well.

        Actually, I did notice that, but that was something that the analyzer changed. I can't remember why.

          Write a Reply...