А так как я использую оболочку phpmyadmin то мне же не нужно знать много команд SQL?
Что бы не изучать лишнего и пока сосредоточится на главном.
SELECT `articles`.`id` AS `id`, `articles`.`title` AS `title`,
GROUP_CONCAT(tags.title) AS `tagsDb`, GROUP_CONCAT(tag_weights.tag_weight) AS `tagsWeight`
FROM `articles` LEFT JOIN `articles_tags` ON `articles`.`id` = `articles_tags`.`article_id`
LEFT JOIN `tags` ON `articles_tags`.`tag_id` = `tags`.`id`
LEFT JOIN (SELECT `articles_tags`.`tag_id` AS `tag_id`,
COUNT(`article_id`) AS `tag_weight` FROM `articles_tags` GROUP BY `tag_id`)
AS `tag_weights` ON `articles_tags`.`tag_id` = `tag_weights`.`tag_id` WHERE `articles`.`id` = 336
$select = $sql->select('articles');
$select->where(array('articles.id = ?' => $id));
$select->join(
'articles_tags', 'articles.id = articles_tags.article_id',
array(),
$select::JOIN_LEFT
);
$select->join(
'tags', 'articles_tags.tag_id = tags.id',
array(),
$select::JOIN_LEFT
);
$subSelect = $sql->select('articles_tags');
$subSelect->columns(array(
'tag_id',
'tag_weight' => new Expression('COUNT(`article_id`)')
));
$subSelect->group('tag_id');
$select->join(
array('tag_weights' => $subSelect),
'articles_tags.tag_id = tag_weights.tag_id',
array(),
$select::JOIN_LEFT
);
$select->columns(array(
'id' => 'id',
'title' => 'title',
'text' => 'text',
'summary' => 'summary',
'categoryId' => 'categoryId',
'author' => 'author',
'created' => 'created',
'updated' => 'updated',
'published' => 'published',
'isPublished' => 'isPublished',
'version' => 'version',
'tagsDb' => new Expression('GROUP_CONCAT(tags.title)'),
'tagsWeight' => new Expression('GROUP_CONCAT(tag_weights.tag_weight)')
));
id title tagsDb tagsWeight
336 sdaf tag1,tag2,tag3,qw 3,3,3,6
mysql_query(" SELECT position, player_id FROM battle WHERE id = '$battle' AND position IN($place) AND player_id != '$player' ");
/**
* @see CommonModule::onLoad()
* CommonModule constructor.
* You can not change the constructor directly, but you can use onLoad function instead.
*/
final function __construct()
/**
* CommonModule constructor.
* You can not change the constructor directly, but you can use onLoad function instead.
*
* @see CommonModule::onLoad()
*/
final function __construct()
function wpdocs_theme_name_scripts() {
wp_enqueue_style( 'style-name', get_stylesheet_uri() );
wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );
function my_js_variables() { ?>
<script type="text/javascript">
var templateUrl = '<?php get_template_directory_uri(); ?>';
</script><?php
}
add_action ( 'wp_head', 'my_js_variables' );
wp_enqueue_script( 'my-script', get_template_directory_uri() . '/js/example.js' );
$translation_array = array( 'templateUrl' => get_template_directory_uri() );
wp_localize_script( 'my-script', 'themename', $translation_array );
var templateUrl = themename.templateUrl;