HI all I am building a website and I am having a problem. I have a search result page where the search result shows pictures. I have the pictures aligned horizontally but I can't figure out how to get more than one row of results. The way I have it coded right now I get one row of pics horizontally and then you must go to the second page. I am trying to add rows under the first. Here is some of my code. I have been trying to design this site from two php books which were given to me but I am having problems with some minor stuff. If anyone can help me I would really appreciate it. I am willing to even trow ya a few bucks thru paypal if you can help me fix this problem!!!


THE CODE:
$ByPage = '7';

$q1 = "select * from listings, agents, priority where listings.AgentID = agents.AgentID and agents.PriorityLevel = priority.PriorityLevel and agents.AccountStatus = 'active' $MyQuery $MyOrder limit $Start, $ByPage ";

$qnav = "select * from istings, agents where listings.AgentID = agents.AgentID $MyQuery";

$r1 = mysql_query($q1) or die(mysql_error());



//get the pics

$q1 = "select * from listings, agents, priority where listings.AgentID = agents.AgentID and agents.PriorityLevel = priority.PriorityLevel and agents.AccountStatus = '1' order by rand() limit 0,4";
$lrows = mysql_num_rows($r1);

if(mysql_num_rows($r1) > '0')
{
$ListingTable .= "<table align=center width=431><tr>\n\t<td colspan=5><BR><BR><strong><font size=4 face=Verdana, Arial, Helvetica, sans-serif>State Name</font></strong><BR><P></td>\n</tr>\n\n<tr>\n\t";

while($a1 = mysql_fetch_array($r1))
{
$al++;

if($al == '1')
{
$align = "align=center";
}
elseif($al == '2')
{
$align = "align=center";
}
else
{
$align = "align=center";
}

$ListingTable .= "<td valign=\"top\" width=100 align=center>\n\n\t\t";

$ListingTable .= "<table width=70 cellspacing=0 border=1 bordercolor=DCDCDC rules=rows>\n\t\t<tr>\n\t\t";
$ListingTable .= "<tr onMouseOver=\"this.style.background='#E2E2E2'; this.style.cursor='hand'\" onMouseOut=\"this.style.background='white'\" onClick=\"window.open('info.php?id=$a1[ListingID]', '_top')\">\n\t";
if(!empty($a1[image]))
{
$im_array = explode("|", $a1[image]);
$ListingTable .= "<td width=70 align=center valign=top><div align=\"center\"><img src=\"re_images/$im_array[0]\" width=70 height=70></div></td>\n\t\t</tr>\n\t\t<tr>\n\t\t <td height=\"10\" align=center valign=top align=center valign=top bgcolor=\"#E9E9E9\"><div align=\"center\"><a class=BlackLink href=\"info.php?id=$a1[ListingID]\">$a1[username]</a></div></td>\n\t\t</tr>\n\t\t";
}

$ListingTable .= "</td>\n\t";

$ListingTable .= "</table>\n\n\t";

$ListingTable .= "</td>\n\n\t";

$fa++;
}

for($fe = '1'; $fe <= (5 - $fa); $fe++)
{
$ListingTable .= "<td width=100>&nbsp;</td>\n\t";
}

$ListingTable .= "</tr>\n\n";

}


if($lrows > '0')
{
$ListingTable .= "<table align=center width=510 bordercolor=black frame=hsides rules=rows cellspacing=0>\n";

while($a1 = mysql_fetch_array($r1))
{
$ListingTable .= "<tr onMouseOver=\"this.style.background='#E2E2E2'; this.style.cursor='hand'\" onMouseOut=\"this.style.background='white'\" onClick=\"window.open('info.php?id=$a1[ListingID]', '_top')\">\n\t";

if($a1[PriorityLevel] > '1')
{
$sub = "<span class=RedLink><sup>$a1[PriorityName]</sup></span>";
}

$ListingTable .= "\n\t<td width=15>";

if(!empty($a1[image]))
{
$im_array = explode("|", $a1[image]);
$ListingTable .= "<img src=\"re_images/$im_array[0]\" width=125 height=93>";
}

$ListingTable .= "</td>\n\t";


}

$ListingTable .= "</table>";

$rnav = mysql_query($qnav) or die(mysql_error());
$rows = mysql_num_rows($rnav);

if($rows > $ByPage)
{
$ListingTable .= "<br><table align=center width=510>";
$ListingTable .= "<td align=center><font face=verdana size=2> | ";

$pages = ceil($rows/$ByPage);

for($i = 0; $i <= ($pages); $i++)
{
$PageStart = $ByPage*$i;

$i2 = $i + 1;

if($PageStart == $Start)
{
$links[] = " <span class=RedLink>$i2</span>\n\t ";
}
elseif($PageStart < $rows)
{
$links[] = " <a class=BlackLink href=\"search.php?Start=$PageStart&c=$_GET[c]&s=$_GET[s]&AgentID=$_GET[AgentID]&search_city=$_GET[search_city]&search_state=$_GET[search_state]&city=$_GET[city]&p=$_GET[p]&r=$_GET[r]\">$i2</a>\n\t ";
}
}

$links2 = implode(" | ", $links);

$ListingTable .= $links2;

$ListingTable .= "| </td>";

$ListingTable .= "</table><br>\n";

}
}
else
{
$ListingTable = "<br><br><center>No results were found!</center>";
}