Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php mysql search database and display results

<?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);
    ?>
Comment

search function using php for database entries

$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);
    ?>
Comment

PREVIOUS NEXT
Code Example
Php :: import facade URL laravel 
Php :: PHP OOP - Classes and Objects 
Php :: How to reset phpmyadmin username and password 
Php :: find substring regx php 
Php :: create function parameters php 
Php :: create new laravel 9 project 
Php :: yii2 html a 
Php :: <a href="<?php echo base_url(); ?"somelink</a 
Php :: php catch all exceptions 
Php :: laravel redirect url 
Php :: or where laravel 
Php :: php get looping month 
Php :: migrate specific migration file laravel 
Php :: php check for null 
Php :: php laravel between dates 
Php :: how do i open a new tab with php 
Php :: How to JSON encode a PHP array 
Php :: How to write a loop in PHP 
Php :: installing php on ubuntu 
Php :: sha256 encryption in php 
Php :: php curl get response body 
Php :: php parse file 
Php :: php generating number 
Php :: show php all errors 
Php :: laravel validation decimal 
Php :: send data from php to python 
Php :: illuminate/container requires php your php version (X.X.XX) does not satisfy that requirement. 
Php :: sort json in php 
Php :: encrypt/decrypt data php 
Php :: laravel grouping where 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =