lpxxfaintxx Posted March 26, 2006 Share Posted March 26, 2006 <?phpif($color==1){echo "<tr bgcolor='#eeeeee'><td>".$rows['status']."</td><td>".$rows['imagename']."</td><td>".$rows['date']."</td><td>".$rows['description']."</td>[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]<td>"<A href='/memberseditimages.php?editid='.$id.>Edit</A>"</td>[!--colorc--][/span][!--/colorc--]</tr>";// Set $color==2, for switching to other color$color="2";}// When $color not equal 1, use this table row colorelse {echo "<tr bgcolor='#c0c0c0'><td>".$rows['status']."</td><td>".$rows['imagename']."</td><td>".$rows['date']."</td><td>".$rows['description']."</td>[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]<td>"<A href='/memberseditimages.php?editid='.$id.>Edit</A>"</td>[!--colorc--][/span][!--/colorc--]?>I want the edit link to be memberseditimages.php?editid=*editit*, but I keep on getting syntax errors. I played around with double and single quotes, but no luck. Can anyone spot the problem? Quote Link to comment https://forums.phpfreaks.com/topic/5843-syntax-error/ Share on other sites More sharing options...
annihilate Posted March 26, 2006 Share Posted March 26, 2006 Try this.[code]<?phpif ($color == 1){echo '<tr bgcolor="#eeeeee"><td>'.$rows['status'].'</td><td>'.$rows['imagename'].'</td><td>'.$rows['date'].'</td><td>'.$rows['description'].'</td><td><a href="/memberseditimages.php?editid='.$id.'">Edit</a></td></tr>';// Set $color==2, for switching to other color$color = 2;}// When $color not equal 1, use this table row colorelse {echo '<tr bgcolor="#c0c0c0"><td>'.$rows['status'].'</td><td>'.$rows['imagename'].'</td><td>'.$rows['date'].'</td><td>'.$rows['description'].'</td><td><a href="/memberseditimages.php?editid='.$id.'">Edit</a></td></tr>?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/5843-syntax-error/#findComment-20824 Share on other sites More sharing options...
lpxxfaintxx Posted March 26, 2006 Author Share Posted March 26, 2006 Did what you said, but I get "Parse error: syntax error, unexpected '=' in /home/lpxxfain/public_html/memberseditimages.php on line 23" Quote Link to comment https://forums.phpfreaks.com/topic/5843-syntax-error/#findComment-20827 Share on other sites More sharing options...
annihilate Posted March 26, 2006 Share Posted March 26, 2006 My fault, didn't close of the last echo statement! Add '; to the end after the last tr. Quote Link to comment https://forums.phpfreaks.com/topic/5843-syntax-error/#findComment-20829 Share on other sites More sharing options...
lpxxfaintxx Posted March 27, 2006 Author Share Posted March 27, 2006 Nope, same problem. Parse error: syntax error, unexpected '=' in /home/lpxxfain/public_html/memberseditimages.php on line 23code:[code]<?phprequire_once "maincore.php";require_once "subheader.php";require_once "side_left.php";$username = $userdata['user_name'];$sql="SELECT * FROM registered_files WHERE owner = '$username'";$result=mysql_query($sql);// Define $color=1$color="1";$rows=mysql_fetch_array($result);$rows['id'] = $id;echo '<table width="1000" border="1" align="center" cellpadding="2" cellspacing="0">';while($rows=mysql_fetch_array($result)){// If $color==1 table row color = #FFC600if($color==1){echo "<tr bgcolor='#eeeeee'><td>".$rows['status']."</td><td>".$rows['imagename']."</td><td>".$rows['date']."</td><td>".$rows['description']."</td><td><a href="/memberseditimages.php?editid='.$id.'">Edit</a></td></tr>";// Set $color==2, for switching to other color$color="2";}// When $color not equal 1, use this table row colorelse {echo "<tr bgcolor='#c0c0c0'><td>".$rows['status']."</td><td>".$rows['imagename']."</td><td>".$rows['date']."</td><td>".$rows['description']."</td><td><a href="/memberseditimages.php?editid='.$id.'">Edit</a></td></tr>";// Set $color back to 1$color="1";}}echo '</table>';require_once "side_right.php";require_once "footer.php";?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/5843-syntax-error/#findComment-21165 Share on other sites More sharing options...
annihilate Posted March 27, 2006 Share Posted March 27, 2006 That is because you have changed my code. [code]echo "<tr bgcolor='#eeeeee'><td>".$rows['status']."</td><td>".$rows['imagename']."</td><td>".$rows['date']."</td><td>".$rows['description']."</td><td><a href="/memberseditimages.php?editid='.$id.'">Edit</a></td></tr>";[/code]In the above, that is not what I posted.Use this:[code]echo '<tr bgcolor="#eeeeee"><td>'.$rows['status'].'</td><td>'.$rows['imagename'].'</td><td>'.$rows['date'].'</td><td>'.$rows['description'].'</td><td><a href="/memberseditimages.php?editid='.$id.'">Edit</a></td></tr>';[/code]And the other echo statement should be this:[code]echo '<tr bgcolor="#c0c0c0"><td>'.$rows['status'].'</td><td>'.$rows['imagename'].'</td><td>'.$rows['date'].'</td><td>'.$rows['description'].'</td><td><a href="/memberseditimages.php?editid='.$id.'">Edit</a></td></tr>';[/code]And I would change lines like $color = "2"; to $color = 2; Quote Link to comment https://forums.phpfreaks.com/topic/5843-syntax-error/#findComment-21166 Share on other sites More sharing options...
lpxxfaintxx Posted March 27, 2006 Author Share Posted March 27, 2006 Oooh! Thanks, you are awesome ;) Quote Link to comment https://forums.phpfreaks.com/topic/5843-syntax-error/#findComment-21365 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.