“PHP MySQL Search Database dan menampilkan hasil” Kode Jawaban

Fungsi pencarian menggunakan PHP untuk entri basis data

$result = mysqli_query($con, "SELECT * FROM employees
    WHERE first_name LIKE '%{$name}%' OR last_name LIKE '%{$name}%'");

while ($row = mysqli_fetch_array($result))
{
        echo $row['first_name'] . " " . $row['last_name'];
        echo "<br>";
}
    mysqli_close($con);
    ?>
Fragile Fly

PHP MySQL Search Database dan menampilkan hasil

<?php
    $con= new mysqli("localhost","root","","Employee");
    $name = $_post['search'];
    //$query = "SELECT * FROM employees
   // WHERE first_name LIKE '%{$name}%' OR last_name LIKE '%{$name}%'";

    // Check connection
    if (mysqli_connect_errno())
      {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
      }

$result = mysqli_query($con, "SELECT * FROM employees
    WHERE first_name LIKE '%{$name}%' OR last_name LIKE '%{$name}%'");

while ($row = mysqli_fetch_array($result))
{
        echo $row['first_name'] . " " . $row['last_name'];
        echo "<br>";
}
    mysqli_close($con);
    ?>
Dizzy Deer

Jawaban yang mirip dengan “PHP MySQL Search Database dan menampilkan hasil”

Pertanyaan yang mirip dengan “PHP MySQL Search Database dan menampilkan hasil”

Lebih banyak jawaban terkait untuk “PHP MySQL Search Database dan menampilkan hasil” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya