When using transactions, you must execute queries using the transaction identifier as the link_identifier in ibase_query.
Example:
$db = ibase_connect( ... );
$tr = ibase_trans();
$result = ibase_query($tr, $sql1);
$result = ibase_query($tr, $sql2);
ibase_rollback($tr);
You must use ibase_query($tr, $sql1). Calling ibase_query($db, $sql1) will not allow you to roll back - it will be commited when the script finishes executing.