Re: function execution problems

From: Date: Wed, 07 Jun 2000 09:32:47 +0000
Subject: Re: function execution problems
Groups: php.general 
Request: Send a blank email to php-general+get-1192@lists.php.net to get a copy of this message
You might have to "reset()" the array pointer at the beginning/end of your function. Steff |-------------> |(Embedded | |image moved | |to file: | |pic19727.pcx)| | | |-------------> >------------------------------------------------------------------------| |dima <dberastau@openworld.co.uk> | |07.06.2000 11:20 | >------------------------------------------------------------------------| To: php-general@lists.php.net cc: (bcc: Stephan Schoell/CHHOS/ABB) Subject: [PHP-GENERAL] function execution problems Security Level:? Internal Hi everybody, I've just come across this pretty wierd function behaviour. I've defined a function that creates an sql string and then fetches the relevant data from MySQL database. It works just fine the first time I call it from the body of the document, however it doesn't complete any subsequent calls. Here is an example that returns an sql string: function dumpit ($tbname) { global $HTTP_GET_VARS; if (!empty ($HTTP_GET_VARS)) { $str = "select num, prc, ref "; $str .= "from $tbname where "; while (list ($key, $val) = each ($HTTP_GET_VARS)) { if (isset ($key)) { $str .= "$key like '$val' and "; } } $str = ereg_replace ("and $", "", $str); return $str; } } As I said, it works just fine the first time I call it, but all the subsequent calls don't get beyond "while" keyword and it just returns "select num, prc, ref from blabla where". I would greately appreciate any pointers in the right direction. thanks a lot. dima -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#1192) next »