Example #1
0
</head>
<body>
<div id="search_form">
	<p class='mycolor'>поиск по столбцу</p>
	<?php 
$test = new MyTable();
if (isset($_POST['text'])) {
    $test->getSearchForm($_POST['select'], $_POST['text']);
} else {
    $test->getSearchForm(NULL, '');
}
?>
</div>
<div id="table" align="center">
<?php 
if ($test->connectDB('localhost', 'root', '', 'orders')) {
    //получаем имя колонки
    if (isset($_GET['sorted'])) {
        $sorted = $_GET['sorted'];
    } else {
        $sorted = NULL;
    }
    //получаем тип сортировки
    if (isset($_GET['type'])) {
        $type = $_GET['type'];
    } else {
        $type = NULL;
    }
    //если поиск
    if (isset($_POST['select']) and isset($_POST['text']) and $_POST['text'] != '') {
        $text = mysql_escape_string($_POST['text']);