MySQL error when adding comments?

Good evening. First, thanks to all who have made ZenPhoto what it is today--an awesome open-source program!! I'm having trouble posting comments to photos. There are no other errors with the site, as the photos, EXIF data, and existing comments all display correctly as intended. However, when trying to post a new comment, I get the following error message:

Zenphoto Error
MySQL Query ( INSERT INTO `zp_comments` (`ownerid`, `name`, `email`, `website`, `comment`, `inmoderation`, `date`, `type`, `ip`, `private`, `anon`) VALUES ("521", "Mister Me", "myemail@here.com", "http://mysite.com", "This is a test comment.", "0", NOW(), "images", "68.116.144.89", "0", "0") ) failed. Error: MySQL server has gone away
It looks like your zenphoto tables haven't been created. You may need to run the setup script.

When I copy and paste the exact query above into CocoaMySQL (my MySQL back-end client), it adds the comment successfully. I've looked at the various functions files, and can't see anything wrong with the functions. It almost appears to be the lack of a db connection, however, the db connects just fine as the comments I post using the back-end client show up just fine in ZenPhoto. Weird. I've tried using other themes, and the comment addition seems to work with others, albeit very slowly (55 seconds+). My current internet connection is showing over 9 MBits/sec. The logic at least makes it past the captcha verification, but fails somewhere thereafter. Is anyone familiar with this issue? My site is http://www.aggiesterlings.com/gallery . In case it helps, here's a copy of my theme's image.php file contents:

<?php $startTime = array_sum(explode(" ",microtime())); if (!defined('WEBPATH')) die(); ?>
<?php require_once ('sterling.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title><?php printGalleryTitle(); ?></title>
<link rel="stylesheet" href="<?php echo $_zp_themeroot ?>/css/gallery.css" type="text/css" />
<script src="http://www.aggiesterlings.com/gallery/zp-core/js/prototype.js" type="text/javascript"></script>
<script src="http://www.aggiesterlings.com/gallery/zp-core/js/effects.js" type="text/javascript"></script>
<script src="http://www.aggiesterlings.com/gallery/zp-core/js/scriptaculous.js" type="text/javascript"></script>
<?php printRSSHeaderLink('Gallery','Gallery RSS'); ?>
<?php zenJavascript(); ?>

<!-- INCLUDE STYLESHEET FOR PHS NAVBAR -->
<link rel="stylesheet" href="<?php echo $_zp_themeroot ?>/css/horizontal_menu.css" type="text/css" media="screen" />

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(function() {
$("#trigger_add").click(function(event) {
event.preventDefault();
$("#box_addComment").slideToggle();
});

$("#box_addComment a").click(function(event) {
event.preventDefault();
$("#box_addComment").slideUp();
});
});

</script>

</head>

<body>
<?php

session_start();
$_SESSION['activeLink'] = 'gallery';
include ('header.inc');
?>

<!-- ################################### -->

<div id="wrap">

<h2>
<span>
" title="Gallery Index"><?php echo getGalleryTitle();?> |
" title="Gallery Index"><?php echo getAlbumTitle();?> |</span>
<?php printImageTitle(true); ?>
</h2>

<div id="fullplate-navigation">

    <?php
    if (hasPrevImage()) {
    echo "\t\t" . '<li id="previous"><a href="' . getPrevImageURL() .
    '" title="Previous Image"><img src="' . $_zp_themeroot .
    '/images/previous.png" width="32" height="32" alt="left ' .
    'arrow" />PREVIOUS' . "\n";
    } else {
    echo "\t\t" . '
  •  
  • ' . "\n";
    }
    if (in_context(ZP_IMAGE)) {
    echo "\t\t" . '<li id="fullSize"><a href="' . getFullImageURL() .
    '" title="Full Size Image">FULL<img src="' . $_zp_themeroot .
    '/images/search.png" width="32" height="32" alt="arrows ' .
    'pointing out" />SIZE' . "\n";
    } else {
    echo "\t\t" . '
  •  
  • ' . "\n";
    }
    if (hasNextImage()) {
    echo "\t\t" . '<li id="next"><a href="' . getNextImageURL() .
    '" title="Next Image">NEXT<img src="' . $_zp_themeroot .
    '/images/next.png" width="32" height="32" alt="right ' .
    'arrow" />' . "\n";
    } else {
    echo "\t\t" . '
  •  
  • ' . "\n";
    }
    ?>
</div>

<div id="fullplate-photo">
<?php printImageDesc(true);?>
<?php

$mw = IMG_MAX_WIDTH;
$mh = IMG_MAX_HEIGHT;
$iw = getFullWidth();
$ih = getFullHeight();

if (isLandscape()) {
if ($iw >= $mw) {
list($nw, $nh) = getSizeCustomImage(null, $mw);
$iw = $nw;
$ih = null;

if ($nh > $mh) {
list($nw, $nh) = getSizeCustomImage(null, null, $mh);
$iw = null;
$ih = $nh;
}
}
/*
echo 'o: ' . getFullWidth() . 'x' . getFullHeight() . "\n";
echo 'i: ' . $iw . 'x' . $ih . "\n";
echo 'm: ' . $mw . 'x' . $mh . "\n";
echo 'n: ' . $nw . 'x' . $nh . "\n";
*/
} else {
if ($ih >= $mh) {
list($nw, $nh) = getSizeCustomImage(null, null, $mh);
$iw = null;
$ih = $nh;

if ($nw > $mw) {
list($nw, $nh) = getSizeCustomImage(null, $mw);
$iw = $nw;
$ih = null;
}
}
/*
echo 'o: ' . getFullWidth() . 'x' . getFullHeight() . "\n";
echo 'i: ' . $iw . 'x' . $ih . "\n";
echo 'm: ' . $mw . 'x' . $mh . "\n";
echo 'n: ' . $nw . 'x' . $nh . "\n";
*/
}
list($imgw, $imgh) = getSizeCustomImage(null, $iw, $ih);
?>
<img src="<?php echo getCustomImageURL(null, $iw, $ih); ?>"
alt="<?php echo getImageTitle(); ?>"
width="<?php echo $imgw; ?>" height="<?php echo $imgh; ?>" />
<h3><?php if (($num = getNumImages()) > 1) { printf(gettext('image %1$u of %2$u'), imageNumber(), getNumImages()); } ?> | <?php printImageDate(); ?> | <?php if (getImageEXIFData()) {echo "".gettext("Image EXIF Info")."";
printImageMetadata('', false);
}
?>
</h3>
<span class="smallText"><font color="red">*</font>Click on the Shutterfly logo in the bottom left corner to order this print.</span>

</div>

<?php if (function_exists('printShutterfly')) printShutterfly(); ?>

<div class="rating"><?php if (function_exists('printImageRating')) printImageRating(); ?></div>

<?php if (getOption('Allow_comments')) { ?>
<div id="comments">
<div class="commentcount">
<?php
$num = getCommentCount();
switch ($num) {
case 0:
echo gettext('<h3>No Comments</h3>');
break;
case 1:
echo gettext('<h3>1 Comment</h3>');
break;
default:
printf(gettext('<h3>%u Comments</h3>'), $num);
}
?></div>

<?php while (next_comment()): ?>
<div class="comment">
<div class="commentmeta">
<span class="commentauthor"><?php printCommentAuthorLink(); ?></span>
| <span class="commentdate"><?php echo getCommentDateTime();?></span>
</div>
<div class="commentbody"><?php echo getCommentBody();?></div>
</div>
<?php endwhile; ?>

<div class="imgcommentform">
<?php if (OpenedForComments()) { ?>
<!-- If comments are on for this image AND album... -->
<h3><?php echo '' . gettext("Add a comment:") . ''; ?></h3>
<font color="red">
<?php
if (printCommentErrors() == '') {
echo '<div id="box_addComment" style="display:none">';
} else {
echo '<div id="box_addComment">';
}
?>
</font>
<form id="commentform" action="#comments" method="post">
<input type="hidden" name="comment" value="1" />
<input type="hidden" name="remember" value="1" />
<?php $stored = getCommentStored();?>
<table border="0">
<tr><td><label for="name"><?php echo gettext("Name:"); ?></label>
(<input type="checkbox" name="anon" value="1"<?php if ($stored['anon']) echo " CHECKED"; ?> /> <?php echo gettext("don't publish"); ?>)
</td>
<td><input type="text" name="name" size="20" value="<?php echo $stored['name'];?>" />
</td></tr>
<tr><td><label for="email"><?php echo gettext("E-Mail (won't be public):"); ?></label></td> <td><input type="text" name="email" size="20" value="<?php echo $stored['email'];?>" /> </td></tr>
<tr><td><label for="website"><?php echo gettext("Site:"); ?></label></td> <td><input type="text" name="website" size="20" value="<?php echo $stored['website'];?>" /></td></tr>
<?php printCaptcha('<tr><td>'.gettext('Enter').' ', ':</td><td>', '</td></tr>'); ?>
<tr><td colspan="2"><input type="checkbox" name="private" value="1" <?php if ($stored['private']) echo " CHECKED"; ?>/> <?php echo gettext("Private (don't publish)"); ?></td></tr>
</table>
<textarea name="comment" rows="6" cols="40"><?php echo $stored['comment']; ?></textarea>
<input type="submit" value="Add Comment" />
</form>
</div>
</div>
<?php } else { echo gettext('Comments are closed.'); } ?>
</div>
<?php } ?>

<div id="foot">
<div id="logo">
<a href="http://www.zenphoto.org"
title="A simpler web photo album"><img
src="http://www.zenphoto.org/images/zenphoto1.gif"
alt="ZenPhoto logo"
width="90" height="24"
/>
</div>

<div id="info">
Website Designed by Philip Sterling
</div>
</div>

</div>
</div>

<?php if (function_exists('printAdminToolbox')) printAdminToolbox(); ?>

</div> <!-- id=page -->
</body>
</html>

Comments

Sign In or Register to comment.