function execution problems

From: Date: Wed, 07 Jun 2000 09:20:38 +0000
Subject: function execution problems
Groups: php.general 
Request: Send a blank email to php-general+get-1190@lists.php.net to get a copy of this message
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

« previous php.general (#1190) next »