Hi Guys
What I am trying to do is allow a 3 x 3 grid of images and then have bottom navigation.
You can see the existing layout at http://areabulgaria.net/properties.php

Here is the code to where I am so far, since I'm no real programmer, its giving me a headache. Could anyone help me to achieve the result please.
Regards
FJW

Function  output_array2(){

//data is available to here from normal listing, i.e one record under the other


$query = "SELECT * FROM Garant";


    $result = mysql_query($query);

    if (!$result) {
        echo "Could not successfully run query ($sql) from DB: " . mysql_error();
        exit;
    }

    if (mysql_num_rows($result) == 0) {
        echo "No rows found, nothing to print so am exiting";
        exit;
    }

if($count = mysql_num_rows($result) > 0) {

$result2 = mysql_query($query);
$row = mysql_fetch_array($result2);
$numrows = $row['count'];

echo "<a href=\"" . $PHP_SELF . "?start=" . ($start - 9) . "\">Previous</a>\n";

if($numrows > ($start + 9)) 
{

    echo "<a href=\"" . $PHP_SELF . "?start=" . ($start + 9) . "\">Next</a>\n";
}

    $max=3; $count=mysql_num_rows($result); //set the number of images across here

    echo "<table border =1><tr>";  
    for($i=0;$i<$max;$i++)  
    {  
       // echo "<td>Column $i+1</td>";  
    }  
    echo "</tr>\n";  
    {  
        $headings = $pics = $locations = '<tr>';  
        for($j=0;$j<$max;$j++)  
        { 
            if($images = mysql_fetch_assoc($result))             
            {  


$pics .="<TD bgcolor=\"#FFFFFF\" width=\"125\" ><A HREF=\"details.php?detail=".$images["id"]." \"><IMG SRC=\"resources/".$images["smallpic"]."\"></A></TD>";

                $locations .= '<td  align="center" bgcolor=#DDEEFF><B>' .$images['Price']. ' Euro - - REF - ' .$images['id'].'</B></td>';  
            } else {  
                $headings .= '<td>&nbsp;</td>';  
                $pics .= '<td>&nbsp;</td>';  
                $locations .= '<td>&nbsp;</td>';  
            }              
        }  
        $headings .= "</tr>\n";  
        $pics .= "</tr>\n";  
        $locations .= "</tr>";  
        echo $headings; 
        echo $pics; 
        echo $locations; 
    }  
    echo '</table>'; 
} 
}

Edited 3 Years Ago by mike_2000_17: Fixed formatting

Hi guys an gals
Well I have almost managed it, you can check out at http://areabulgaria.net/properties2.php .
Now I have a problem of large space under the images. Can anyone help me to get rid of it
to leave just 9 pictures and the bottom navigation on one page.

Function  output_array2(){
// If current page number, use it 
// if not, set one! 

if(!isset($_GET['page'])){ 
    $page = 1; 
} else { 
    $page = $_GET['page']; 
} 

// Define the number of results per page 
$max_results = 10; 

// Figure out the limit for the query based 
// on the current page number. 
$from = (($page * $max_results) - $max_results);  

// Perform MySQL query on only the current page number's results 

$sql = mysql_query("SELECT * FROM Garant LIMIT $from, $max_results"); 
$result = mysql_query($sql);

while($row = mysql_fetch_array($sql))
{ 
    // Build your formatted results here.  
$count = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM Garant"),0); 
if($count > 0) {  
    $max=3; //set the number of images across here

    echo "<table>";  

    for($i=0;$i<$count;$i+=$max) /* loop through and build the table */  
    {  
        $headings = $pics = $locations = '<tr>';  
        for($j=0;$j<$max;$j++)  
        { 
            if($row = mysql_fetch_assoc($sql))             
            {  


$pics .="<TD bgcolor=\"#FFFFFF\" width=\"125\" ><A HREF=\"details.php?detail=".$row["id"]." \"><IMG SRC=\"resources/".$row["smallpic"]."\"></A></TD>";
$locations .= '<td  align="center" bgcolor=#DDEEFF><B>' .$row['Price']. ' Euro - ref - ' .$row['id'].'</td>';  
            } else {  
               // $headings .= '<td>&nbsp;</td>';  
                $pics .= '<td>&nbsp;</td>';  
                $locations .= '<td>&nbsp;</td>';  
            }              
        }  
        $headings .= "</tr>\n";  
        $pics .= "</tr>\n";  
        $locations .= "</tr>";  
        echo $headings; 
        echo $pics; 
        echo $locations; 
    }  
    echo '</table>'; 
} 
}

// Figure out the total number of results in DB: 
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM Garant"),0); 

// Figure out the total number of pages. Always round up using ceil() 
$total_pages = ceil($total_results / $max_results); 

// Build Page Number Hyperlinks 
echo "<center>Select a Page<br />"; 

// Build Previous Link 
if($page > 1){ 
    $prev = ($page - 1); 
    echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\"><<Previous</a> "; 
} 

for($i = 1; $i <= $total_pages; $i++){ 
    if(($page) == $i){ 
        echo "$i "; 
        } else { 
            echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> "; 
    } 
} 

// Build Next Link 
if($page < $total_pages){ 
    $next = ($page + 1); 
    echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$next\">Next>></a>"; 
} 
echo "</center>"; 
}

Edited 3 Years Ago by mike_2000_17: Fixed formatting

Solved. Thanks to all those who had posted similar answers to this problem.
Without you guys I would be nowhere.
Sincere thanks
FJW

This question has already been answered. Start a new discussion instead.