Subject RE: [firebird-php] Formatting blobs into tables
Author Nigel Weeks
> Now, I know this is probably dreadful practice for people who
> know what
> they're doing, but what I have had to do is convert the blob
> fields into
> varchar fields and then fetch the info' with:

Surely that code is easier to read like this:

<?
$dbh = ibase_connect('C:/data/artists.fdb','*****','*****','ISO8859_1',0,1);
$sql="SELECT CHARACTERS FROM men WHERE CHARACTERS IS NOT NULL ORDER BY
LASTNAME ASC";
$result=ibase_query($sql)or die(ibase_errcode());
$num_cols=2;
$rows = 0;
echo "<center><table border=1 cellpadding=1 cellspacing=10 width=720>";
while ($obj = ibase_fetch_object($result)){
if($rows % $num_cols == 0){
// Is this the first line?
if($rows == 0){
// Yes, it is
echo "<TR>";
} else {
// No, so break the line as well
echo "</TR>\n<TR>";
}
}
// Increment the rows counter
$rows++;
// Put the content in the box
echo "<td width=360>$obj->CHARACTERS</td>";
}
echo "</TR></TABLE></CENTER>\n";
?>



Oh, maybe not. It's about the same length with comments!! ;-)


As for including it from the .shtml file - no problems there.

Nige.