Archive for the ‘MySql’ Category

Trace:

#0 /home/.../public_html/app/code/core/Mage/Core/Model/Store.php(712): Zend_Uri::factory('{{base_url}}')
#1 /home/.../public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(313): Mage_Core_Model_Store->isCurrentlySecure()
#2 /home/.../public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(161): Mage_Core_Controller_Varien_Front->_checkBaseUrl(Object(Mage_Core_Controller_Request_Http))
#3 /home/.../public_html/app/code/core/Mage/Core/Model/App.php(349): Mage_Core_Controller_Varien_Front->dispatch()
#4 /home/.../public_html/app/Mage.php(640): Mage_Core_Model_App->run(Array)
#5 /home/.../public_html/index.php(80): Mage::run('', 'store')
#6 {main}

Solutions:

If you are receiving the error above, you can fix this by updating the Magento core_config_data table.

Change ‘web/unsecure/url’ value to, http://.com/ and  ‘web/secure/url’ value to, http://.com/

I faced the problem to access the admin panel of Magento today. I found the solution that insert the Sql code into your database :

 

SET FOREIGN_KEY_CHECKS=0;
UPDATE `core_store` SET store_id = 0 WHERE code='admin';
UPDATE `core_store_group` SET group_id = 0 WHERE name='Default';
UPDATE `core_website` SET website_id = 0 WHERE code='admin';
UPDATE `customer_group` SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN';
SET FOREIGN_KEY_CHECKS=1;

Sometimes we confuse about how to mysql insert into multiple tables at a time ? This so easy just like below the code

INSERT INTO table1(c1, c2, c3), table2(c4, c5, c6) VALUES ('v1', 'v2',
'v3',v4, 'v5', 'v6');

That’s all.

Creating Joomla component called mvc

Posted: November 9, 2010 in Joomla, MySql, PHP
Tags: , ,
Today I shall create component called mvc. The tutorial is discussed below step by step :
  1. Create folder administrator/components/com_mvc.
  2. Create file administrator/components/com_mvc/admin.mvc.php. This is standard Joomla file that will be launched on access to the component.

    File listing: admin.mvc.php

<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
require_once (JPATH_COMPONENT.DS.'controller.php');
if($controller = JRequest::getVar('controller')) {
require_once (JPATH_COMPONENT.DS.'controllers'.
DS.$controller.'.php');
}
$classname = 'MvcController'.
ucfirst($controller);
$controller = new $classname( );
$controller->execute( JRequest::getVar('task'));
$controller->redirect();
?>

(more…)

PHP Project-5: Counter script tutorial

Posted: November 7, 2010 in MySql, PHP
Tags: ,

In this tutorial create 1 file
1. counter.php

Step
1. Create table “counter” in database “test”.
2. Create file counter.php.

1. Create table “counter”

CREATE TABLE `counter` (
`counter` int(9) NOT NULL default '0'
) TYPE=MyISAM;

(more…)