Jump to content

Archived

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

lpxxfaintxx

Syntax Error

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?

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites
Did what you said, but I get "Parse error: syntax error, unexpected '=' in /home/lpxxfain/public_html/memberseditimages.php on line 23"

Share this post


Link to post
Share on other sites
My fault, didn't close of the last echo statement! Add '; to the end after the last tr.

Share this post


Link to post
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]

Share this post


Link to post
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;

Share this post


Link to post
Share on other sites

×

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.