/    Sign up×
Community /Pin to ProfileBookmark

ridiculous error

Parse error: parse error, unexpected $ in /www/w/wick*****esc/htdocs/parkeriscool/admin/main.php on line 414

[code]
<?php
$admin = 1;
require(“../header.php”);

/*— BEGIN HANDLING THE FORM REQUESTS — */

if ($_POST[‘mkalbum’]){
if (mkalbum($_POST[‘album_name’], $_POST[‘album_desc’])){
$response = $response . “The album was successfully created.n”;
}
else{
$response = $response . ‘There was an error creating the new album, MySQL said: ‘ . mysql_error();
}
}

if($_POST[‘dltalbum’]){
if(dltalbum_pics_server($_POST[‘dltalbum_album’])){
if(dltalbum_pics_db($_POST[‘dltalbum_album’])){
if(dltalbum_db($_POST[‘dltalbum_album’])){
$response = $response . “The album was successfully deleted.n”;
}
else{
$response = $response . “There was an error deleting the album from the `albums` database table. MySQL said: ” . mysql_error() . “n”;
}
}
else{
$response = $response . “There was an error removing the pictures in the album from the `pics` database table. MySQL said: ” . mysql_error() . “n”;
}
}
else{
$response = $response . “There was an error deleting the pictures in the album from the server. They have been moved or already deleted, there may have never been any, or there may have been a more serious error. I’m going to go ahead and try to delete the other parts of the album anyway. MySQL said: ” . mysql_error() . “n”;
if(dltalbum_pics_db($_POST[‘dltalbum_album’])){
if(dltalbum_db($_POST[‘dltalbum_album’])){
$response = $response . “The album was successfully deleted.n”;
}
else{
$response = $response . “There was an error deleting the album from the `albums` database table. MySQL said: ” . mysql_error() . “n”;
}
}
else{
$response = $response . “There was an error removing the pictures in the album from the `pics` database table. MySQL said: ” . mysql_error() . “n”;
}
}
}

if ($_POST[‘upload_pic’]){
if (uploadpic(“../pics/”)){
if(mkthumb($_FILES[‘uploadpic’] [‘name’], “../pics/”)){
if (add_to_album($_FILES[‘uploadpic’] [‘name’], “pics/”, $_POST[‘upoadpic_caption’], $_POST[‘uploadpic_album’])){
if(update($_POST[‘uploadpic_album’])){
$response = $response . “The picture was successsfully added to the album.n”;
}
else{
$response = $response . “There was an error updating the last updated date for the album, however everything else went to plan and your picture will still appear in the album. MySQL said: ” . mysql_error() . “n”;
}

}
else{
$response = $response . “There was an error adding the pic to the album’s databse table. MySQL said: ” . mysql_error() . “n”;
}
}
else{
$response = $response . “There was a problem creating the picture’s thumbnail.n”;
}
}
else{
$response = $response . “There was a problem uploading the picture.n”;
// display a message according do exactly what went wrong
switch ($_FILES[‘uploadpic’] [‘error’]){
case 1:
$response = $response . “The file is bigger than this PHP installation allows.n”;
break;
case 2:
$response = $response . “The file is bigger than this form allows.n”;
break;
case 3:
$response = $response . “Only part of the file was uploaded.n”;
break;
case 4:
$response = $response . “No file was uploaded.n”;
break;
}
}
}

if($_POST[‘pics_admin’]){
$album = $_POST[‘album’];
$result = mysql_query(“SELECT * FROM `pics` WHERE `album` = ‘$album'”);
while($pic = mysql_fetch_array($result)){
if($_POST[‘dlt_’ . $pic[name]]){
if(dltpic_db($pic[name])){
if(dltpic_svr($pic[name])){
$ok += 1;
}
}

}
$num += 1;
}
$response = $response . “$ok of the requested $num pics have been successfully deleted” . “n”;

while($pic = mysql_fetch_array($result)){
if($_POST[‘caption_’ . $pics[name]]){
if(mysql_query(“UPDATE `pics` SET `caption` = ‘” . $_POST[‘caption_’ . $pics[name]] . “‘ WHERE `name` = ‘$pics[name]'”) && mysql_affect_rows()){
$ok += 1;
}
}
$num += 1;
}
$response = $response . “$ok of the requested $num captions have been successfully updated” . “n”;
}

/*— FINISH HANDLING THE FORM REQUESTS — */

?>

<?php echo $response ?>

<?php
//echo(table_contents(“albums”));
//echo(table_contents(“pics”));
?>

CREATE A NEW ALBUM:<br />
<form method=”post” action=”<?php echo $_SERVER[‘PHP_SELF’] ?>”>
<p>
<input type=”hidden” name=”mkalbum” value=”1″ />
name: <input type=”text” name=”album_name” />
<br />
desc: <input type=”text” name=”album_desc” />
<br />
<input type=”submit” value=”Create” />
</p>
</form>

DELETE AN ALBUM:<br />
<form method=”post” action=”<?php echo $_SERVER[‘PHP_SELF’] ?>” onsubmit=”return confirm(‘Are you sure that you want to delete this album and all of the pictures in it?’)”>
<p>
<input type=”hidden” name=”dltalbum” value=”1″ />
<select name=”dltalbum_album”>
<?php
$result = mysql_query(“SELECT `name` FROM `albums`”) or die(‘Error selecting the albums from the database, MySQL said: ‘ . mysql_error());
while ($album = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo(‘<option value=”‘ . $album[name] . ‘”>’ . $album[name] . ‘</option>’);
}
?>
</select>
<input type=”submit” value=”Delete” />
</p>
</form>

<br />

UPLOAD A PICTURE:<br />
<form method=”post” enctype=”multipart/form-data” action=”<?php echo $_SERVER[‘PHP_SELF’] ?>”>
<p>
<input type=”hidden” name=”upload_pic” value=”1″ />
pic: <input type=”file” name=”uploadpic” /><br />
<input type=”hidden” name=”MAX_FILE_SIZE” value=”9999999999999999999999″ />
caption: <input type=”text” name=”upoadpic_caption” />
<input type=”submit” value=”Upload” />
<select name=”uploadpic_album”>
<?php
$result = mysql_query(“SELECT `name` FROM `albums`”) or die(‘Error selecting the albums from the database, MySQL said: ‘ . mysql_error());
while ($album = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo(‘<option value=”‘ . $album[name] . ‘”>’ . $album[name] . ‘</option>’);
}
?>
</select>
</p>
</form>

EDIT THE PICS IN AN ALBUM!

<?php
require(“../footer.php”);
?>
[/code]

i had to cut out a big block of code there to gt this posted, that error message refers to the very last line, which is odd because all it has is the ending php tag. ive had the footer there like that forever and it has worked fine. WHAT IS WRONG!!??!?!?!?!?!

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJul 17.2005 — Best guess without being able to run the code is that the error is in footer.php.
Copy linkTweet thisAlerts:
@felgallJul 17.2005 — Often an error on the last line means that there is something rong much earlier but that the parser was unaware that an expected entry was missing until it reached the end. The way I usually work out such errors is to comment out different pieces of the code and see what affect that has on the error messages produced. When I manage to get rid of the error message or get a different message relating to the commented code then I know that I am getting closer to finding where the error actually is.
Copy linkTweet thisAlerts:
@Stephen_PhilbinJul 17.2005 — I make a point of memorising the causes of these sorts of wierd and impossible errors. Unfortunately though, I always seem to forget this one. I'm about 70% sure that this one is caused by missing parenthesis. It might be a } parenthesis, but I think this one comes from a missing ).

If you have an editor like [url=http://www.jedit.org/]JEdit[/url] then you can easily track down these bugs because if you leave your cursor on one parenthesis, it'll point out it's closing partner and let you know if you're missing one. Either that or you missed a semi colon ( ; ) and the parser didn't notice. It's only something simple, I remember that much at least.
Copy linkTweet thisAlerts:
@BeachSideJul 18.2005 — Don't know why this error isn't showing up but in that code above your missing a semicolon
[code=php]
[B]<?php echo $response ?>[/B]
[/code]

::Edit:: Found another two...
[code=php]
<form method="post" action="[B]<?php echo $_SERVER['PHP_SELF'] ?>[/B]">
[/code]

and
[code=php]
DELETE AN ALBUM:<br />
<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" onsubmit="return confirm('Are you sure that you want to delete this album and all of the pictures in it?')">
[/code]


::Edit2::

and another...
[code=php]
UPLOAD A PICTURE:<br />
<form method="post" enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF'] ?>">[/code]
×

Success!

Help @gameguy43 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...