[SOLVED] Variable won't change its value

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
oyse
Forum Newbie
Posts: 6
Joined: Wed Jul 07, 2004 3:37 am

[SOLVED] Variable won't change its value

Post 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
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

removed most of the code for readablility
Think you may of removed too much.
Deemo
Forum Contributor
Posts: 418
Joined: Sun Jan 18, 2004 11:48 am
Location: Washington DC

Post by Deemo »

also, make sure the loop is executing in the first place
oyse
Forum Newbie
Posts: 6
Joined: Wed Jul 07, 2004 3:37 am

Post 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
Post Reply