public function up() { $this->dbforge->add_field(array( 'Price' => array( 'type' => 'DECIMAL', 'constraint' => '10,2', 'unsigned' => FALSE ) )); $this->dbforge->create_table('ads'); }
Tuesday, February 19, 2013
How do I add a decimal field in a Codeigniter Migration
Tuesday, February 12, 2013
Wamp virtual hosts
Open C:\wamp\bin\apache\apache2.2.22\conf\httpd.conf
Uncomment
Sample
Uncomment
#Include conf/extra/httpd-vhosts.confit will be
Include conf/extra/httpd-vhosts.conf
Open C:\wamp\bin\apache\apache2.2.22\conf\extra\httpd-vhosts.conf to add/edit virtual hosts
Sample
NameVirtualHost *:80DocumentRoot "c:/wamp/www/" ServerName localhost ServerAlias www.localhost
Windows how to switch php version between 5.2 and 5.3
- Download Wamp for PHP 5.3 from http://www.wampserver.com/en/ or direct link
- Download PHP 5.2.9 addon at http://downloads.sourceforge.net/wampserver/WampServer2-PHP529-2.exe?download
now you can switch php version
** WARNING : You must install Visual C++ 2010 SP1 Redistributable Package x86 or x64
VC10 SP1 vcredist_x86.exe 32 bits : http://www.microsoft.com/download/en/details.aspx?id=8328
VC10 SP1 vcredist_x64.exe 64 bits : http://www.microsoft.com/download/en/details.aspx?id=13523
Codeigniter cache model sample
model
if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Countries_model extends CI_Model { public function get_countries() { $query = $this->db->get('countries'); if ($query->num_rows() > 0) { return $query->result(); } else { return FALSE; } } public function get_cache() { if ( ! $countries = $this->cache->get('countries')) { $countries = $this->get_countries(); $this->cache->save('countries', $countries, 86400); } return $countries; } }controller
$this->countries_model->get_cache();
Subscribe to:
Posts (Atom)