<?php
include('functions.php');
email('pasha.leshiov@gmail.com', 'test');
?>
<?php
function mysql_con($db){
mysql_connect('localhost', 'vdscloud', '123');
mysql_select_db($db);
mysql_query('SET NAMES utf8;');
}
function email($email, $template){
$subject = 'VDS Cloud - Новый заказ';
mysql_con('vdscloud');
$query = mysql_query("SELECT * FROM mails WHERE name=$template");
$mail = mysql_fetch_array($query, MYSQL_ASSOC);
$html = '
<html>
<body>
'.$mail['html'].'
</body>
</html>
';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($email, $mail['subject'], $html, $headers);
}
?>
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /var/www/vdscloud/data/www/test.vds-cloud.ru/functions.php on line 29