Page 1 of 1

php variable scope issue

Posted: Wed May 14, 2008 8:33 pm
by definewebsites
Hi there,

I am implementing a hit counter on a website using cookies and have some php script that retrieves the count from adatabase and assigns it to a variable. I have this script at the top of the page before all the html related syntax.

I am printing the count in the footer of my pages, which is obtained externally through a php 'include' statement.

However, the count does not show. Nothing appears on the screen. I would like to know whether the variable created at the top of the page has page-wide significance. I created the variable with the 'global' syntax, and it should work. However it is not.

Any ideas?

Cheers

Re: php variable scope issue

Posted: Fri May 16, 2008 3:02 pm
by kendall
I don't think the cookie would be recognized until the page is refreshed...