Не получается вывести данные из бд через кнопку поиск, в чем ошибка? я хочу чтобы выводились данные через поиск и их можно было бы удалить или отредактировать. Вот примерно такой формы PHP: <?php require_once "head.php"; ?> <?php $isAddClient = isset($_GET['add_client']); $isDeleteClient = isset($_GET['delete']); $isU = isset($_GET['u']); if($isDeleteClient) { $id = $_GET['delete']; $stmt = $DBH->prepare("DELETE FROM `clients_table` WHERE `id` = :id"); $stmt->bindParam(":id", $id); $stmt->execute(); header("location: index.php?page=clients"); } else if($isAddClient) { $fio = $_GET["client_fio"]; $phone = $_GET["client_phone"]; $carNumber = $_GET["client_carNumber"]; $passport = $_GET["client_passport"]; $stmt = $DBH->prepare("INSERT INTO `clients_table` VALUES(NULL, :fio, :phone, :carNumber, :passport)"); $stmt->bindParam(":fio", $fio); $stmt->bindParam(":phone", $phone); $stmt->bindParam(":carNumber", $carNumber); $stmt->bindParam(":passport", $passport); $stmt->execute(); header("location: index.php?page=clients"); } else if($isU) { $stmt = $DBH->prepare("UPDATE `clients_table` SET `fio` = :fio, `phone` = :phone, `carNumber` = :car, `passport` = :pass WHERE `id` = :id"); $stmt->bindParam(":fio", $_GET['fio-1']); $stmt->bindParam(":phone", $_GET['phone-1']); $stmt->bindParam(":car", $_GET['car-1']); $stmt->bindParam(":pass", $_GET['pass-1']); $stmt->bindParam(":id", $_GET['id-1']); $stmt->execute(); header('location: index.php?page=clients'); } ?> <?php if (isset($_POST['search_buttom'])) { $car_number = $_POST['search_car_number']; $stmt = $DBH->prepare("SELECT * FROM `clients_table` WHERE `carNumber` = :car_number"); $stmt->bindParam(":car_number", $car_number); $stmt->execute(); echo '<form method="post"> <input type="text" value="'.$car_number.'" required /> <input type="submit" value="Добавить" /> </form>'; } ?> <form method='POST' action='' name='search_form'> <input type='text' name='search_car_number' value='' placeholder='Введите номер машины'> <input type='submit' name='search_buttom' value='Поиск'> </form> <div class="wrap1"> <div class="table clients vopros"> <div class="table-row"> <div class="table-cell"> # </div> <div class="table-cell"> ФИО </div> <div class="table-cell"> Тел. номер </div> <div class="table-cell"> Номер машины </div> <div class="table-cell"> Паспортные данные </div> <div class="table-cell"> Действия </div> </div> <form class="table-row" action="index.php?page=clients" method="get"> <div class="table-cell"> </div> <div class="table-cell"> <input type="text" name="client_fio" placeholder="Петров Петр Петрович" required="on" autocomplete="off"> </div> <div class="table-cell"> <input type="text" maxlength="11" onkeyup="this.value = this.value.replace (/[^\d]/g, '')" name="client_phone" placeholder="88005553535" required="on" autocomplete="off"> </div> <div class="table-cell"> <input type="text" name="client_carNumber" placeholder="о000оо" required="on" autocomplete="off"> </div> <div class="table-cell"> <input type="text" onkeyup="this.value = this.value.replace (/[^\d-]/g, '')" name="client_passport" placeholder="111-123123" required="on" autocomplete="off"> </div> <div class="table-cell"> <input type="submit" name="add_client" value="Добавить клиента"> </div> <input type="hidden" name="page" value="clients"> </form> <?php $stmt = $DBH->prepare("SELECT * FROM `clients_table` ORDER BY `id` DESC"); $stmt->execute(); while($row = $stmt->fetch(PDO::FETCH_OBJ)): ?> <form class="table-row"> <div class="table-cell"> <?= $row->id ?> </div> <div class="table-cell"> <input type="text" name="fio-1" value="<?= $row->fio ?>" required> </div> <div class="table-cell"> <input type="text" maxlength="11" onkeyup="this.value = this.value.replace (/[^\d]/g, '')" name="phone-1" value="<?= $row->phone ?>" required> </div> <div class="table-cell"> <input type="text" name="car-1" value="<?= $row->carNumber ?>" required> </div> <div class="table-cell"> <input type="text" onkeyup="this.value = this.value.replace (/[^\d-]/g, '')" name="pass-1" value="<?= $row->passport ?>" required> </div> <div class="table-cell"> <a class="silka" href="?page=clients&delete=<?= $row->id ?>"> Удалить </a> <input type="submit" name="u" value="Изменить"></div> <input type="hidden" name="page" value="clients"> <input type="hidden" name="id-1" value="<?= $row->id ?>"> </form> <?php endwhile; ?> </div> </div>
в БД строка с номером карты существует? если да и не получается, то пробуй PHP: $stmt = $DBH -> prepare( "SELECT * FROM `clients_table` WHERE `carNumber` = НОМЕР_КАРТЫ_ВСТАВЬ");
Это я должен знать или все таки ты? в таблице clients_table номер карты в столбце carNumber циферки которые ищешь они существуют ??