You can install the Php Pages component in joomla 1.5. Where you can write your own php code in joomla.
Also using this component of Php Pages you can also write a request in the php code itself.
So you can extract data from the database.
source share