Subject RE: [firebird-support] SQL statement with multiply function
Author Nigel Weeks
> -----Original Message-----
> From: firebird-support@yahoogroups.com
> [mailto:firebird-support@yahoogroups.com]On Behalf Of majstoru
> Sent: Wednesday, 15 March 2006 12:12 PM
> To: firebird-support@yahoogroups.com
> Subject: [firebird-support] SQL statement with multiply function
>
>
> Hi,
>
> I have a data in table (example)
> Table1
> id name qty
> 1 Article 1 3
> 2 Article 2 2
> 3 Article 3 1
>

To do this on the client side, I'd use PHP...

<?php
$conn = ibase_connect("server:/path/to/database.fdb","sysdba","masterkey");
$sql = "select * from Table1";
$rec = ibase_query($sql);
while($obj = ibase_fetch_object($rec)){
// Now do a loop for each article
for($a=0; $a < $obj->QTY; $a++){
echo "Sticker for '".$obj->NAME."'";
} // End of qty loop
} // End of record while loop
?>

That's why I love PHP! Too easy!
If you want a demo of this to run directly against your database, without
having to install PHP, let me know!
(I can roll a tiny .zip with all files necessary to run this)

Nige.