Month: September 2013

Copy data from one table to another in Zend

New Table structure

id email_id date status
1 xyz@hotmail.com 2013-09-04 10:59:17 1
2 abc@gmail.com 2013-09-04 10:59:17 0
3 test@gmail.com 2013-09-04 10:59:17 1

insert data from one Table to another Table Query

Query :

$obj=new Table_object;

$obj2=new Table_object

$Email_addreesGet=$obj->select()->from($obj,array(’email_id’))->where(“status=1”);

$Email_AdrresData = $obj->fetchAll($Email_addreesGet);

foreach ($Email_AdrresData as $Row) {

$data = $Row->toArray();
$obj2->insert($data);

}

 

insert data from one table to another in mysql

New Table structure

id email_id date status
1 xyz@hotmail.com 2013-09-04 10:59:17 1
2 abc@gmail.com 2013-09-04 10:59:17 1
3 test@gmail.com 2013-09-04 10:59:17 1

insert data from one Table to another Table Query

Query :

Insert into newtable(email_id) Select ’email_id’ from oldtable.