Jump to content

unexpected '}'


almightyegg

Recommended Posts

I can't see what the problem with this is?

 

Parse error: syntax error, unexpected '}' in /home/lordofth/public_html/editlinks.php on line 101

 

if(!$setlink && !$set && !$delete && !$cancel){ ?>
<b>Custom Links:</b><br>
<?
if(!$mem[link1]){
echo "<a href='editlinks.php?setlink=1'>Set Link 1</a><br>";
}else{
echo "<a href='$mem[link1]'>$mem[linkn1]</a> [<a href='editlinks.php?setlink=1'>Relink</a>] [<a href='/editlinks.php?delete=1'>Delete</a>]<br>";
}
if(!$mem[link2]){
echo "<a href='editlinks.php?setlink=2'>Set Link 2</a><br>";
}else{
echo "<a href='$mem[link2]'>$mem[linkn2]</a> [<a href='editlinks.php?setlink=2'>Relink</a>] [<a href='/editlinks.php?delete=2'>Delete</a>]<br>";
}
if(!$mem[link3]){
echo "<a href='editlinks.php?setlink=3'>Set Link 3</a><br>";
}else{
echo "<a href='$mem[link3]'>$mem[linkn3]</a> [<a href='editlinks.php?setlink=3'>Relink</a>] [<a href='/editlinks.php?delete=3'>Delete</a>]<br>";
}
if(!$mem[link4]){
echo "<a href='editlinks.php?setlink=4'>Set Link 4</a><br>";
}else{
echo "<a href='$mem[link4]'>$mem[linkn4]</a> [<a href='editlinks.php?setlink=4'>Relink</a>] [<a href='/editlinks.php?delete=4'>Delete</a>]<br>";
}
if(!$mem[link5]){
echo "<a href='editlinks.php?setlink=5'>Set Link 5</a><br>";
}else{
echo "<a href='$mem[link5]'>$mem[linkn5]</a> [<a href='editlinks.php?setlink=5'>Relink</a>] [<a href='/editlinks.php?delete=5'>Delete</a>]<br>";
}
}elseif(is_numeric($setlink) == TRUE){
$update = mysql_query("UPDATE users SET qlupdate='$setlink' WHERE id='{$mem['id']}'");
echo "Direct to the page you wish to link in and confirm it on the right panel under the other links.";
}elseif($set == yes){
$link = $_POST['link'];
$linkn = $_POST['linkn'];
if(!$link){
echo "You haven't selected a link!";
}else{
$l = "link$mem[qlupdate]";
$n = "linkn$mem[qlupdate]";
$update = mysql_query("UPDATE users SET $l='$link',$n='$linkn',qlupdate='No' WHERE id='{$mem['id']}'");
echo "Your custom link was updated.";
}
}elseif(is_numeric($delete) == TRUE){
$update = mysql_query("UPDATE users SET link$delete='',linkn$delete='' WHERE id='{$mem['id']}'");
echo "You removed custom link number $delete.";
}elseif($cancel = yes){
$update = mysql_query("UPDATE users SET qlupdate='No' WHERE id='{$mem['id']}'");
echo "You cancelled the updating process.";
}
?>

 

I can't spot why it might be unexpected... any help would be greatly appreciated

 

Link to comment
https://forums.phpfreaks.com/topic/97887-unexpected/
Share on other sites

hi

 

towards the bottom if statement

 

$cancel = yes

should be

$cancel == yes

 

few more tips:

$l = "link$mem[qlupdate]";
$n = "linkn$mem[qlupdate]";

 

should be:

$l = "link{$mem[qlupdate]}";
$n = "linkn{$mem[qlupdate]}";

 

One more:

don't test if a var is set like this:

!$var

use isSet() like this:

!isSet($var)

 

I'd read through your php log file and correct the warnings it's printing

 

 

Link to comment
https://forums.phpfreaks.com/topic/97887-unexpected/#findComment-500842
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.