DELIMITER $$
CREATE TRIGGER after_members_insert
AFTER INSERT
ON members FOR EACH ROW
BEGIN
IF NEW.birthDate IS NULL THEN
INSERT INTO reminders(memberId, message)
VALUES(new.id,CONCAT('Hi ', NEW.name, ', please update your date of birth.'));
END IF;
END$$
DELIMITER ;
echo '<a href="' . htmlspecialchars($row['homepage']) . '">Перейти</a>';
echo '<a href="' . htmlspecialchars((0 === strpos($row['homepage'], 'http')? $row['homepage']: 'http://' . $row['homepage']) . '">Перейти</a>';
SELECT `юзеры`.*
FROM `юзеры`
INNER JOIN `города`
ON `города`.`id` = `юзеры`.`город_id`
INNER JOIN `области`
ON `области`.`id` = `города`.`область_id`
INNER JOIN `страны`
ON `страны`.`id` = `области`.`страна_id`
WHERE `страны`.`страна` = 'Россия'
SELECT count(*)
FROM `Users`
WHERE `Login` LIKE 'a%'
SELECT * FROM menu ORDER BY position
SELECT * FROM `menu` ORDER BY `position`
$pdo = new PDO('mysql:host=locahost;dbname=mydatabase', 'user', 'passsword');
$query->prepare('SELECT * FROM `menu` ORDER BY `position`');
$query->execute();
$menu_all = $query->fetchAll(PDO::FETCH_ASSOC);
CREATE TABLE `User` (
`user_id` int not null,
...
);
CREATE TABLE `Product` (
`product_id` int not null,
`product_name` varchar(100),
...
);
CREATE TABLE `UserPrice` (
`user_price_id` int not null,
`user_id` int not null,
`product_id` int not null,
`price` decimal(10, 2) not null,
...
);
SELECT `Product`.*, `UserPrice`.`price`
FROM `UserPrice`
INNER JOIN `Product` ON `Product`.`product_id` = `UserPrice`.`product_id`
WHERE `user_id` = 10