...

View Full Version : Code won't work in functions



cyphix
05-21-2004, 05:12 PM
I was trying to use my own function to repeat the same code over & over without using it all in the page again but have a problem..

Code works fine when not called via a function, but when I call the exact same code via the function, I have a problem..

The problem is that when I refer to a SESSION variable it doesn't work.

Any clue?

Thanks!

raf
05-21-2004, 07:49 PM
maybe post the code of that function ...

sad69
05-21-2004, 08:07 PM
I find that sometimes I have to 'globalize' a variable declared outside of the function to use it inside.


$count = 0;
function inc_counter() {
global $count;
$count++;
}


I don't know much about sessions as I've never used them before, but perhaps it's something similar?

Posting the relevant pieces of code would be helpful though..

Sadiq.

cyphix
05-21-2004, 09:11 PM
The code is really a bit to long to post (around 300 lines). I'll try & work with how I got it now. :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum