How to Change Database Settings In Magento

2:32 PM 0

How to change Magento Database Settings.

1- Go to magento/app/etc/local.xml (see blow picture)




2- Open local.xml then you will find the below code.



3- Enter Username: Enter Username of database.
4- Enter Password: Enter Password of database.
5- Enter Database Name: Enter Name of database.
6- Now Save and Refresh the page..
7- Enjoy

Magento Get Current Product ID

3:44 PM 0
How to get current product id in magento. Blow code will display currently loaded product id..



<!-- Magento Current Product Id -->
        <?php $current_product_id = $this->getProduct()->getId(); ?>

If above code not working then try below code..
<!-- Magento Current Product Id -->
<?php 
$current_product_id = Mage::registry('current_product')->getId();
?>

Codeigniter Display Last Query

2:03 PM 0

The following code return the last query that was running in codeigniter.
Sometimes we want to display which query was currently running. For this purpose just echo
the query then it will display the last query that was run.


<!-- Codeigniter last Query -->
   <?php 
    $last_query = $this->db->last_query();
    ?>
<!-- It will produce: SELECT * FROM table WHERE.... -->