I do volunteer work to a website by putting up their calendar and putting new entries into their database for their webpages.
The old webmaster wrote the .php code a few years agoand it's been working fine until this week, but maybe it's because they are doing more photo collections this year??
I added three entries into the database and the page doesn't show them. I "think" it's because the page will only display nine entries for the "new" photos. It divides the newest and then the older ones go in the second half of the table, entitled "archived".
I don't know hardly anything about php. The only reason I do this is because I do understand databases.
Can someone just take a look at the code and tell me what might need to be changed?
THANK YOU IN ADVANCE! I will learn this...and I wish I could return the favor!
Here's the code:
PHP Code:
echo "<div style='width:100%;height:180px;background-color:#FFFFFF;border-style:solid;border-width:2;overflow-x:auto;overflow-y:auto;'>";
}
?>
<table cellpadding="2" cellspacing="2" width="100%" border="0">
<?php
$sql = "SELECT collection_name, collection_desc, collection_link, photographer, date_format(collection_dt,'%b %e, %Y') AS collection_dt FROM photos ";
$sql .= "WHERE datetime BETWEEN date_add(now(), interval -365 day) AND now() ";
$sql .= "ORDER BY datetime DESC";
$result = mysql_query($sql, $conn) or die(mysql_error());
while ($newArray = mysql_fetch_array($result)) {
$pName = $newArray['collection_name'];
$pDesc = $newArray['collection_desc'];
if (strlen($pDesc) < 1) {
$pDesc = $pName." Photo Collection";
}
$pURL = $newArray['collection_link'];
$pPhotographer = $newArray['photographer'];
if (strlen($pPhotographer) < 1) {
$pPhotographer = "Anonymous";
}
$pDate = $newArray['collection_dt'];
if (strlen($pDate) < 1) {
$pDate = "";
} else {
$pDate = "  [Taken: ".$pDate."]";
}
echo "<tr>";
echo "<td class='row1'><a href='$pURL' style='text-decoration:none' title='Click to open this Photo Collection'><b>";
echo $pName;
echo "</b><br>$pDesc<br>";
echo "<font class='Copyright'>Photographer: $pPhotographer $pDate</font>";
echo "</a></td>";
echo "</tr>";
}
?>
</table>
</div>
</td>
</tr>
<tr height="20" class="BlueHeader">
<td width="100%">Archived Photo Collections</td>
</tr>
<tr>
<td align="center">
<?php
if (strpos($browser, "MSIE") > 0) {
echo "<div style='width:100%;height:180px;background-color:#FFFFFF;border-style:solid;border-width:2;overflow-x:auto;overflow-y:auto;'>";
}
?>
<table cellpadding="2" cellspacing="2" width="100%" border="0">
<?php
$sql = "SELECT collection_name, collection_desc, collection_link, photographer FROM photos ";
$sql .= "WHERE datetime BETWEEN date_add(now(), interval -1460 day) AND date_add(now(), interval -365 day)";
$sql .= "ORDER BY datetime DESC";
$result = mysql_query($sql, $conn) or die(mysql_error());
while ($newArray = mysql_fetch_array($result)) {
$pName = $newArray['collection_name'];
$pDesc = $newArray['collection_desc'];
if (strlen($pDesc) < 1) {
$pDesc = $pName." Photo Collection";
}
$pURL = $newArray['collection_link'];
$pPhotographer = $newArray['photographer'];
if (strlen($pPhotographer) < 1) {
$pPhotographer = "Anonymous";
}
$pDate = $newArray['collection_dt'];
if (strlen($pDate) < 1) {
$pDate = "";
} else {
$pDate = "  [Taken: ".$pDate."]";
}
echo "<tr>";
echo "<td class='row1'><a href='$pURL' style='text-decoration:none' title='Click to open this Photo Collection'><b>";
echo $pName;
echo "</b><br>$pDesc<br>";
echo "<font class='Copyright'>Photographer: $pPhotographer</font>";
echo "</a></td>";
echo "</tr>";
}
?>
</table>
</div>
Bookmarks