Jump to content

Syntax Error


lpxxfaintxx

Recommended Posts


<?php
if($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 color
else {
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?
Link to comment
https://forums.phpfreaks.com/topic/5843-syntax-error/
Share on other sites

Try this.
[code]<?php
if ($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 color
else
{
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]
Link to comment
https://forums.phpfreaks.com/topic/5843-syntax-error/#findComment-20824
Share on other sites

Nope, same problem.
Parse error: syntax error, unexpected '=' in /home/lpxxfain/public_html/memberseditimages.php on line 23


code:

[code]<?php
require_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 = #FFC600
if($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 color
else {
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]
Link to comment
https://forums.phpfreaks.com/topic/5843-syntax-error/#findComment-21165
Share on other sites

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;
Link to comment
https://forums.phpfreaks.com/topic/5843-syntax-error/#findComment-21166
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.