Example #1
0
}
include_once './db_connect.php';
include_once './func.php';
//подключаемся к базе
$dbh = mysql_connect(host, user, pswd) or die("Не могу соединиться с MySQL.");
mysql_select_db(SCAD) or die("Не могу подключиться к базе.");
mysql_query("SET NAMES utf8");
//обновляем группы для подбора стали
$groups_for_steel = new TMemberGroupSteel11();
$s = $groups_for_steel->set_to_scad_spr();
$body_hex = bin2hex($s);
$sql = "UPDATE " . document_bin . " SET body = 0x{$body_hex} WHERE number = " . D_member_group_for_steel;
mysql_query($sql);
//обновляем комбинации
$combinations = new TCombination();
$s = $combinations->set_to_scad_spr();
$body_hex = bin2hex($s);
$sql = "UPDATE " . document_bin . " SET body = 0x{$body_hex} WHERE number = " . D_combinations;
mysql_query($sql);
define('START_OFFSET', 8);
define('MAX_DOC', 100);
//собираем документ
$today = date("d.m.Y");
header("Content-Disposition: attachment; filename={$today}.spr");
header("Content-Type: application/octet-stream");
$sql = "SELECT * FROM " . document_bin;
mysql_query($sql);
switch (mysql_errno()) {
    case 1146:
        echo "<b>Table " . document_bin . " doesn't exist. Please create DB.</b><br>";
        break;