Very Weird

phpnutphpnut Junior MemberShared Hoster
Okay... I'm encountering a very strange problem.
I've been using a page that retrieves photograph info and URLs from a database and displays them in a table in rows three columns across.
For some reason, the page is not displaying all the rows in the database that match the query sent to it - but was working this morning, and I have not touched it since.
Here's the code, hopefully someone can point out what's wrong.

[PHP]<?php
session_start();
include("/files/includes/headerinclude.php");
echo "<body>";
echo "<table border='0' cellspacing='1' cellpadding='1' width='700' align='center'>";
echo "<tr>";
echo "<td colspan='2' valign='bottom' align='left'>";
include("/files/includes/topimageinclude.php");
echo "</td>";
echo "</tr>";
echo "<tr>
<td valign='bottom' align='left' colspan='2'>";
include("/files/includes/navbarinclude.php");
echo "</td></tr>";
echo "<tr>";
echo "<td width='100' valign='top' align='left'>";
include("/files/includes/sidebarinclude.php");
echo "</td>";
echo "<td width='600' valign='top' align='center'>";
$gallery = strip_tags($_GET);
$landing = strip_tags($_GET);
$dbhost = "****";
$dbuser = "****";
$dbpass = "****";
$db = "siteinfo";
$connect = mysql_connect($dbhost,$dbuser,$dbpass)
or die("No can do");
$selectdb = mysql_select_db($db,$connect)
or die("sorry");
if(isset($landing))
{
$query = "SELECT id,gallery,thumb FROM photographs WHERE gallery = '$gallery' AND landing = '$landing'";
}
else
{
$query = "SELECT id,gallery,thumb FROM photographs WHERE gallery = '$gallery'";
}
$res = mysql_query($query)
or die("haha");
$cnt = mysql_num_rows($res);
$countervar = "0";
echo "<table width='600' border='0' cellspacing='5' cellpadding='5'>";
echo "<tr valign='center' align='center'>";
while($row = mysql_fetch_array($res,MYSQL_ASSOC))
{
extract($row);
echo "<td><a href='/galleries/displayPhoto.php?id={$id}'><img src='/images/galleries/thumb/{$thumb}' border='0' alt=''></a></td>";
$countervar = $countervar + 1;
if($countervar>=3)
{
echo "</td></tr><tr valign='center' align='center'>";
$countervar = 0;
}
}
echo "</tr></table>";
echo "</td>";
echo "</tr></table>";
include("/files/includes/footerinclude.php");
echo "</body>";
echo "</html>";
?>[/PHP]

I'd like to think my host is being buggy... but I can't think of how that'd be possible with something like this.
My ongoing projects...
www.naturesmagazine.com
www.energyreform.org *new domain*
www.photographyavenue.com
----
You may also remember me as imnewtophp...

Comments

Sign In or Register to comment.