"Lung linh bóng nước con đò, Nhớ sao Chợ Mới câu hò thủy chung
Quê tôi miền đất anh hùng, Hôm nay vẫn đẹp vô cùng ai ơi!"

"Giờ thăm lại trường xưa trong khoảnh khắc
Cảnh còn đây người đi mất từ lâu..."

"對我而言台灣留下非常深刻的印象,我所去的每一個地方,我所見過的每一個人,這都是緣分!
再見大家,再見台灣!"

A greeting from Vietnam.

Showing posts with label Zend. Show all posts
Showing posts with label Zend. Show all posts

Thursday, August 15, 2013

Install a Zend project

1. Copy the project source to www.
2. Copy Zend library to www.
3. Open httpd.conf and add these commands:
      NameVirtualHost *:80
      <VirtualHost *:80>
          ServerName btg
          DocumentRoot "C:\Program Files\EasyPHP-5.3.9\www\btg\public"
          SetEnv APPLICATION_ENV "development"
          <Directory "C:\Program Files\EasyPHP-5.3.9\www\btg\public">
              DirectoryIndex index.php
              AllowOverride All
              Order allow,deny
              Allow from all
          </Directory>
      </VirtualHost>

4. Open hosts file and add this command:
127.0.0.1       localhost btg
5. Open php.ini and modify the include_path:
            include_path = ".;${path}\php\includes;${path}\www\zend\library"
(replace btg and the url to yours!)

Tuesday, July 9, 2013

Inserting and Removing Table Row

To insert a row to table:
function themdong(idbang, iddongcu, iddongmoi, idocu, idomoi){
dongmoi=$('#'+idbang+' tr:last').clone();
dongmoi.appendTo('#'+idbang);

//modify new row's attribute: 
$('#'+idbang).find('tr:last').attr('id', function(index, id) {
return id.replace(iddongcu, iddongmoi);
});

//modify new cell's attribute: 
dongmoi.find('td').attr('id', function(index, id) {
return id.replace(idocu, idomoi);
});
}

To remove a row from table:

Thursday, May 30, 2013

Register and Remove a session in Zend

To register a session in Zend, you may use Zend_Session_Namespace class. And then, just assign value for your session variables:
$job = new Zend_Session_Namespace('application');
$job->username = 'test';
To remove username from the session just do :
unset($job->username);
To remove the whole 'application' namespace and asociated data you can use :
Zend_Session::namespaceUnset('application');

Sunday, May 12, 2013

Insert a group of data rows into table by Zend

fetchAssoc(): returns data in an array of associative arrays, using the first column as the array index. Example, import a group of rows into another table:
$data=$this->DB->fetchAssoc("SELECT MSSV, HoTen FROM sinhvien WHERE KhoaHoc=3");
foreach($data as $key=>$value){
$d=array(
 
  'MaSo'=>$value['MSSV'],
 
  'Ten'=>$value['HoTen']);
 
$this->DB->insert('thisinh',$d);
}
Another example:
print_r($db->fetchAll('select col1, col2 from table'));
Array
(
    [0] => Array
        (
            [col1] => 1
            [col2] => 2
        )
)