$people = array('Иван Иваныч', 'Сергей Сергеич', 'Сидор Сидорович');
// INSERT INTO `organization` (`name`) VALUES (?), (?), (?)
$query = "INSERT INTO `organization` (`name`) VALUES "
. implode(', ', array_fill(0, sizeof($people), '(?)'));
$pdo->prepare($sql)->execute($people);
$people = array(
array('Иван Иваныч', 'Москва', 23),
array('Сергей Сергеич', 'Тула', 42),
array('Сидор Сидорович', 'Псков', 30),
);
// Приводим массив к виду:
// array('Иван Иваныч', 'Москва', 23, 'Сергей Сергеич', 'Тула', 42, 'Сидор Сидорович', 'Псков', 30);
$values = array();
foreach ($people as $p) {
$values = array_merge($values, $p);
}
// Создаём строку вида (?, ?, ?)
$placeholders = '(' . implode(', ', array_fill(0, 3, '?')) . ')';
// INSERT INTO `organization` (`name`, `city`, `age`) VALUES (?, ?, ?), (?, ?, ?), (?, ?, ?)
$query = "INSERT INTO `organization` (`name`, `city`, `age`) VALUES "
. implode(', ', array_fill(0, sizeof($people), $placeholders));
$pdo->prepare($sql)->execute($values);
@value: true;
.mixin (@color) {
// Тут все правила, использующие @color...
}
& when (@value = false) {
.mixin(#000);
}
& when (@value = true) {
.mixin(#FFF);
}
mysql_query() возвращает дескриптор результата запроса (resource), или FALSE в случае ошибки.
$username = htmlspecialchars($_POST['username']);
$password = htmlspecialchars($_POST['password']);
$query = mysql_query("SELECT * FROM usertbl WHERE username='".$username."' AND `password`='".$password."'");
if (!$query) {
die('Ошибка: ' . mysql_error());
}
$numrows = mysql_num_rows($query);
SELECT
`entity`.`entity_name`,
`group`.`title`,
`atr`.`attribute_name`,
`val`.`value_name`
FROM `eav_entities` as `entity`
JOIN `products` as `products` ON (`entity`.`entity_id` = `products`.`entity_id`)
JOIN `eav_attributes` as `atr` ON (`products`.`attribute_id` = `atr`.`attribute_id`)
JOIN `eav_values` as `val` ON (`products`.`value_id` = `val`.`value_id`)
JOIN `group_attributes` as `group` ON (`atr`.`group_id` = `group`.`group_id`);
<div id="post-<?php the_ID(); ?>" <?php post_class( 'product1' ); ?>>
<a href="<?php the_permalink(); ?>">
<?php
if ( $cwp_rev_product_image ) {
echo '<div class="product1-image" style="background-image: url('. $cwp_rev_product_image .')"></div>';
} else {
echo '<div class="product1-image" style="background-image: url('. get_template_directory_uri() .'/images/no-image2.png)"></div>';
}
?>
</a>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="product1-title">
<?php the_title(); ?>
</a><!--/a. product1-title-->
<?php
if ( $option_overall_grade ) {
echo '<div class="product1-stars"><div class="stars_active" style="width: '. $option_overall_grade .'%;"></div></div>';
}
if ( !empty( $affiliate_text ) && !empty( $affiliate_link ) ) {
echo '<div class="affiliate-button2 affiliate-button button-buy">';
echo '<a href="'. $affiliate_link .'" rel="nofollow" target="_blank">';
echo '<span>'. $affiliate_text .'</span>';
echo '</a>';
echo '</div>';
}
?>
</div><!--/div .product1-->