0

Hi Guys
I'm rusty and sticking after being ill for months.
Could anyone help me to get this to work please. I've got it close but not close enough. Thanks in advance for the time given.
Best FJW

echo $pricelow;
echo $pricehigh;

output_arrayBETW(); //$pricelow and $pricehigh correct BUT...

Function  output_arrayBETW(){

printf("<basefont size=\"2\" color=\"blue\">");

//data is available to here from normal listing, i.e one record under the other
$sql = "SELECT * FROM Garant WHERE Price BETWEEN '".$pricelow."' AND '".$pricehigh."' ORDER By Ref";

    $result = mysql_query($sql);

    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;
    }

    // While a row of data exists, put that row in $row as an associative array
    // Note: If you're expecting just one row, no need to use a loop
    // Note: If you put extract($row); inside the following loop, you'll
    //       then create $userid, $fullname, and $userstatus

if($count = mysql_num_rows($result) > 0) {  
    $max=4; $count=mysql_num_rows($result); //set the number of images across here

    echo "<table>";  
    //for($i=0;$i<$max;$i++)  
   // {  
       // echo "<td>Column $i+1</td>";  
   // }  
   // echo "</tr>\n"; 
 
    for($i=0;$i<$count;$i+=$max) /* loop through and build the table */  
    {  
        $headings = $pics = $locations = '<tr>';  

        for($j=0;$j<$max;$j++)  
        { 
            if($images = mysql_fetch_assoc($result))             
            {  
            

$pics .="<TD bgcolor=\"#B74F8F\"  border=\"2\"><A HREF=\"details.php?detail=".$images["Ref"]." \"><IMG  SRC=\"resources/".$images["smallpic"]."\"></A></TD>";

          $locations .= '<td  align="left" bgcolor=#DDEEFF><B> ' .$images['Ref']. '    Price: ' .$images['Price'].' Euro</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 by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by phobia1
0
output_arrayBETW($pricelow, $pricehigh); //$pricelow and $pricehigh correct BUT...

Function  output_arrayBETW($pricelow, $pricehigh){

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.