$data
вместо $btc_convert_rub
class CardTags extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'card_tags';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['card_id', 'tags_id'], 'integer'],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'card_id' => 'Card ID',
'tags_id' => 'Tags ID',
];
}
}
public function getCard()
{
return $this->hasMany(Card::className(), ['id' => 'card_id'])
->viaTable('card_tags', ['tags_id' => 'id']);
}
public function getTags()
{
return $this->hasMany(Tags::className(), ['id' => 'tags_id'])
->viaTable('card_tags', ['card_id' => 'id']);
}
Card::find()->with('tags')
->joinWith(['tags' => function(\yii\db\ActiveQuery $query){
$query->from(['tags' => Tags::find()->where(['tags.id' => 1])]);
}])
->joinWith(['tags' => function(\yii\db\ActiveQuery $query){
$query->from(['t' => Tags::find()->where(['t.id' => 2])]);
}]);
SQLSTATE[42S22]: Column not found: 1054 Unknown column 't.id' in 'where clause'
The SQL being executed was: SELECT COUNT(*) FROM `card` LEFT JOIN `card_tags` ON `card`.`id` = `card_tags`.`card_id` LEFT JOIN (SELECT * FROM `tags` WHERE `tags`.`id`=1) `tags` ON `card_tags`.`tags_id` = `tags`.`id` LEFT JOIN (SELECT * FROM `tags` WHERE `t`.`id`=1) `t` ON `card_tags`.`tags_id` = `t`.`id`
$query = Card::find()->with('tags')
->joinWith(['tags' => function(\yii\db\ActiveQuery $query){
$query->from(['tags' => Tags::find()->where(['tags.id' => 1])]);
}])
->joinWith(['tags' => function(\yii\db\ActiveQuery $query){
$query->from(['tags' => Tags::find()->where(['tags.id' => 2])]);
}]);
Database Exception – yii\db\Exception
SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: 'tags'
The SQL being executed was: SELECT COUNT(*) FROM `card` LEFT JOIN `card_tags` ON `card`.`id` = `card_tags`.`card_id` LEFT JOIN (SELECT * FROM `tags` WHERE `tags`.`id`=1) `tags` ON `card_tags`.`tags_id` = `tags`.`id` LEFT JOIN (SELECT * FROM `tags` WHERE `tags`.`id`=2) `tags` ON `card_tags`.`tags_id` = `tags`.`id`
"babel-core": "*",
"babel-loader": "*",
"babel-plugin-transform-runtime": "*",
"babel-preset-es2015": "*",
"css-loader": "*",
"vue": "^2.5.16",
"vue-cli": "*",
"vue-html-loader": "*",
"vue-loader": "*",
"vue-style-loader": "*",
"vue-template": "^1.0.3",
"vue-template-compiler": "*",
"webpack": "^4.1.1",
"webpack-cli": "^2.0.12"
$html = curl_get('https://coinmarketcap.com/currencies/ripple/historical-data/?start=20130428&end=20171209');
$dom = str_get_html($html);
echo "<pre>";
print_r($html);
HTTP/1.1 200 OK
Date: Sat, 09 Dec 2017 20:46:28 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: __cfduid=d8e678f8b85d743e319149482103afb421512852387; expires=Sun, 09-Dec-18 20:46:27 GMT; path=/; domain=.coinmarketcap.com; HttpOnly; Secure
CF-Cache-Status: EXPIRED
Server: cloudflare-nginx
CF-RAY: 3caad05fad0a83ee-KBP
$fh = fopen('train-images-idx3-ubyte', 'rb');
fseek( $fh, 16);
$byteString = fread($fh, 784);
$arr = unpack( 'C', $byteString);
print_r($arr);
Array ( [1] => 0 )
echo $arr[28];
- ошибка, так как такого элемента нет в массиве.
array_filter
строку$data
, а нужно передавать массив