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
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
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
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
Share on other sites

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.