Jump to content

Recommended Posts

why onlly one color appear?

 

while ($Row = mysql_fetch_array ($Result)) 
				{ 		

					If ($color = "#FFFFDF")
						$color = "#DBFCFC";
					else	
						$color = "#FFFFDF";


					$Row[selling_price]= number_format($Row[selling_price],2);				
					print ("<TR ALIGN=center bgcolor=$color VALIGN=top>\n"); 
					echo"<td align=center><a href='post-premiumreview.php?id=$Row[premPropertyID]'><font color='#3300CC'>".$Row[premPropertyID]."</font></a></td>";	

					print ("<TD ALIGN=center VALIGN=top>".$Row['type1']." </TD>\n"); 
					print ("<TD ALIGN=center VALIGN=top>".$Row['state']." </TD>\n"); 
					print ("<TD ALIGN=center VALIGN=top>".$Row['selling_price']."</TD>\n"); 
					print ("<TD ALIGN=center VALIGN=top>".$Row['type3']."</TD>\n"); 
					print ("<TD ALIGN=center VALIGN=top>".$Row['buildup_area']."</TD>\n"); 
					print ("<TD ALIGN=center VALIGN=top>".$Row['datePosted']."</TD>\n"); 
					print ("</TR>\n"); 						
				} 				

Replace:

 

If ($color = "#FFFFDF")

 

with:

 

if ($color == "#FFFFDF")

 

'=' is assigment operator, so currently your code simply always assigns the value "#FFFFDF" to $color, which then evaluates true (because the return value of assigment operator is the value assigned) and then the color is always assigned to "#DBFCFC".

 

In other words, you should have been using == instead, because that's the actual comparison operator.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.