INSERT INTO `product` (`sku`, `stock_status_id`, `status`, `quantity`, `price`)
VALUES (...), (...), (...)
ON DUPLICATE KEY UPDATE `stock_status_id` = VALUES(`stock_status_id`), `status` = ...
SELECT `h`.`iduser`, `h`.`hisuser`, `r`.`id`, `r`.`text`
FROM `his` AS `h`
INNER JOIN `rew` AS `r` ON `r`.`id` = `h`.`hisuser`
WHERE `h`.`iduser` = {определенный id}
mysql_query("insert into `logerror`(`date`, `message`) VALUES (now(),'".mysql_real_escape_string($artr)."')");