 |
 |
$conn=pg_connect("dbname=uctiles user=sqluser password=iadmin");
$sql="select * from products where category=2 order by price";
$result=pg_exec($conn,$sql);
if (pg_numrows($result) > 0)
{
$line=0;
//clear the cache for the file_exists function
clearstatcache();
print " | Code: | Name: | Price: | Size / Quantity: | ";
while ($line < pg_numrows($result))
{
$display=pg_fetch_array($result,$line);
if ($display[toptile]=="Y")
$fontcolor="green";
else
$fontcolor="black";
print "| ";
print "$display[code] | ";
print "$display[name] | ";
print "R " . number_format($display[price],2) . " | ";
print "" . nl2br($display[description]) . " | ";
//work out the value of the image field using the value of the code
$pos = strpos($display[code]," ");
if ($pos === false)
$image=$display[code];
else
$image=substr($display[code],0,$pos);
$file="/home/httpd/html/uctiles/morepics/" . $image . "_1.jpg";
if (file_exists($file))
{
print "";
print "More Pictures";
}
print " | ";
$file="/home/httpd/html/uctiles/products/$display[image]";
if (file_exists($file))
print " ";
else
print " ";
print " | ";
$line++;
}
print "
";
}
else
{
print "There are currently no $title in the database.";
print " ";
}
pg_close($conn);
?>
.Other links
|