Page 1 of 1

[SOLVED] Variable won't change its value

Posted: Thu Jul 15, 2004 3:29 pm
by oyse
I have the following code ( removed most of the code for readablility ):

Code: Select all

$start = "";
$end = "";

while( $columnName = mysql_fetch_array( $columnNames, MYSQL_ASSOC ) ){

           /* search all columns for all search strings */
	foreach( $this->searchWords as $word ){

	}
	
	echo $end . ' ' . $start . '<br />';
	$start = "AND ( ";
	$end = ")";

}
The problem is that the variable $start and $end never change value. Does anyone have a clue of what is wrong? Setting the variables before the while statement like this $start = "test" only makes the code print test several times.

oyse

Posted: Thu Jul 15, 2004 4:13 pm
by Buddha443556
removed most of the code for readablility
Think you may of removed too much.

Posted: Thu Jul 15, 2004 4:54 pm
by Deemo
also, make sure the loop is executing in the first place

Posted: Thu Jul 15, 2004 5:02 pm
by oyse
I tried to remove all the pieces of the code that didn't seem to have anything to do with the problem. The code I posted still produced the bug. Now I have of course changed my code and can't recreate it, and the code I posted works perfectly now. Strange. Maybe I did some stupid mistake that I didn't see and corrected it without knowing.

Well with everything working I should be happy.

oyse