Thanks for the reply!
 
I must admit i and confused by the answer to the global variables question.
Can i ask another question? What if i want to increment a global counter from within a 
function. at the moment i am trying to declare the variable normally:
 
$counter=0;
then within the function:
function (){
global $counter;
$counter++;
}
 
but then when i go to echo $counter outside of the function its value hasnt changed? 
Yet again any help would be appreciatted!



Dirk Kredler <[EMAIL PROTECTED]> wrote:
Am Dienstag, 15. Juli 2003 14:39 schrieb bob pilly:
> Can i declare an array that doesnt have a fixed size? Basically i want to
> assign the results of a query to the array but obviously the query results
> can change. Something along the lines of:

$myarray= array();

> while($temp=mssql_fetch_array($tmresult)){
> brandnew array = $temp["fieldname"];

$myarray[]= $temp["fieldname"];

> }

> this doesnt work for me, any ideas?
> Also is it possible to have global variables within php? I have noticed
> that if i create a function i cant write to what i thought were global
> variables(declared outside the function). Im not trying to pass variables
> between pages, just use a global counter within a single page?

$globalvar= 'Hi there';

function afunction() {
global $globalvar;

echo($globalvar);

}



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




---------------------------------
Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger

Reply via email to