вот мой класс
ClassPribor.php
<?php
class pribor
{
//private $db_host='localhost';
//private $db_database='pribor';
//private $db_username='fog';
//private $db_password='12345';
function __construct()
{
$this->con();
}
function __destruct()
{
mysql_close($connection);
echo 'close connect';
}
function con()
{
include('login.php');
$connection = mysql_connect( $db_host, $db_username, $db_password );
if (!$connection)
{
die("Невозможно подключиться к базе данных: <br />". mysql_error());
}
$db_select=mysql_select_db($db_database);
if (!$db_select)
{
die("Невозможно подключиться к базе: <br />". mysql_error());
}
}
function tekmes()
{
echo "<link rel = 'stylesheet' href = 'myscreen.css' type = 'text/css'>";
mysql_query(' SET character_set_results = cp1251');
$query = "SELECT cod, name, ser_number, date_proisv, rab_diap, model, signal_d, oboznach, uchastok, date_kor, result, d_next_kal, (
DAYofyear( d_next_kal ) - DAYofyear( NOW( ) )
) AS kolvo, 'не повер ' AS pov
FROM `materials2`
WHERE MONTH( d_next_kal ) = MONTH( NOW( ) )
AND YEAR( d_next_kal ) = YEAR( NOW( ) )
UNION
SELECT cod, name, ser_number, date_proisv, rab_diap, model, signal_d, oboznach, uchastok, date_kor, result, d_next_kal, (
DAYofyear( d_next_kal ) - DAYofyear( NOW( ) )
) AS kolvo, 'повереные' AS pov
FROM `materials_otm`
WHERE MONTH( d_next_kal ) = MONTH( NOW( ) )
AND YEAR( d_next_kal ) = YEAR( NOW( ) )
order by d_next_kal";
// Исполнить запрос
$result = mysql_query( $query );
if (!$result)
{
die("Невозможно исполнить запрос к базе данных: <br />". mysql_error());
}
echo '<table border="0" height = "100%" width ="100% cellspacing = "1" frame ="vsides" bordercolor = "red" background = "black">';
echo "<tr><th>Номер</th><th>Наименование</th><th>Модель</th&g t;<th>Диапазон </th><th>Дата поверки</th><th>Дни</th><th>Дата поверки</th></tr>";
while ($result_row = mysql_fetch_array(($result))) {
echo '<tr>';
echo '<ss><td>' .$result_row["ser_number"] . '</td></ss>';
echo '<td>' .$result_row["name"] . '</td>';
echo '<td><d>'. $result_row["model"] . '</d></td>';
echo '<td><d>'. $result_row["rab_diap"] . '</d></td>';
echo '<td><d>'. $result_row["d_next_kal"] . '</d></td>';
echo '<td><d>'. $result_row["kolvo"] . '</d></td>';
echo '<td><a href="purchase.php?title_id='.$result_row["cod"]
.'">Доп. свед</a></td></tr>';
}
echo "</table>";
}
//********************************************************************************
//poisk
function poisk($search)
{
echo "<link rel = 'stylesheet' href = 'myscreen.css' type = 'text/css'>";
mysql_query(' SET character_set_results = cp1251');
$query = "SELECT * FROM materials2 ".
"WHERE ser_number like '$search%' order by ser_number";
// Исполнить запрос
$result = mysql_query( $query );
if (!$result)
{
die("Невозможно исполнить запрос к базе данных: <br />". mysql_error());
}
echo '<table border="0" height = "100%" width ="100% cellspacing = "1" frame ="vsides" bordercolor = "red" background = "black">';
echo "<tr><th>Номер</th><th>Наименование</th><th>Модель</th&g t;<th>Диапазон </th><th>Дата поверки</th><th>Дата поверки</th></tr>";
while ($result_row = mysql_fetch_array(($result))) {
echo '<tr>';
echo '<ss><td>' .$result_row["ser_number"] . '</td></ss>';
echo '<td>' .$result_row["name"] . '</td>';
echo '<td><d>'. $result_row["model"] . '</d></td>';
echo '<td><d>'. $result_row["rab_diap"] . '</d></td>';
echo '<td><d>'. $result_row["d_next_kal"] . '</d></td>';
//echo '<td><d>'. $result_row["kolvo"] . '</d></td>';
echo '<td><a href="purchase.php?title_id='.$result_row["cod"]
.'">Доп. свед</a></td></tr>';
}
echo "</table>";
// Закрыть соединение
}
}
?>
далее в другом php файле пишу
include 'ClassPribor.php'
$mypribor = new pribor;
$mypribor->poisk('5')
но выходит ошибка типа такого обьекта нет
ПОДСКАЖИТЕ ПОЖАЙЛУСТА ЧТО ДЕЛАТЬ!!!