Guys please guide me to take a particular row of records from table1 on local database and insert into table1 on remote database.
Guys please guide me to take a particular row of records from table1 on local database and insert into table1 on remote database.
Check the official guide on how to do basic DB operations.
Yes ,
My problem is Yii only accepts this kind of array
$values = array (
‘id’ => ‘7’,
‘user_type’ => ‘2’,
‘email_id’ => ‘staff@emperic.co’,
‘password’ => ‘8cb2237d0679ca88db6464eac60da96345513964’,
‘is_logged_in’ => ‘1’,
‘created_date’ => ‘2018-10-03 11:52:21’,
‘status’ => ‘1’
);
But I got my select result array like below yii is not accept this arrray as value
$values = Array (
[id] => 1
[user_type] => 1
[email_id] => fori@care.com
[password] => 8cb2237d0679ca88db6464eac60da96345513964
[is_logged_in] => 1
[created_date] => 2018-10-04 11:21:08
[status] => 1
);
Yii::app()->dbb->createCommand()->insert(‘user’,$values);
Well, form new array from another array.
I don’t see why not. You haven’t presented enough information for us to see what you’re doing wrong.
Btw: SHA-1(“12345”) = 8cb2237d0679ca88db6464eac60da96345513964
So don’t use that password. And SHA-1 hashing is not secure for password storage.
I tried a lot but i can’t form an array like this using PHP.
$values = array (
‘id’ = ‘7’,
‘user_type’ = ‘2’,
‘email_id’ = ‘staff@emperic.co’,
‘password’ = ‘8cb2237d0679ca88db6464eac60da96345513964’,
‘is_logged_in’ = ‘1’,
‘created_date’ = ‘2018-10-03 11:52:21’,
‘status’ = ‘1’
);
is there any option to form an array using yii
Thanks for your information Fsb.
In PHP, =
is the assignment operator, so the above code says to assign the value "7"
to the string "id"
. You can’t assign to a string literal in PHP so it doesn’t compile. In PHP you assign to variables and to object properties.
Read about arrays here.
I guess what you really want is something like
$values = array(
'id' => 7,
'user_type' => 2,
...
);
Notice the =>
token separating key from value.
Exactly Fsb is it possible to do in php using loop to create an array like this.
$values = array(
‘id’ => 7,
‘user_type’ => 2,
…
);
Thank You Sam
hello, can you give me a reference to the code that adds data to a table in another db