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 :: execute specific migration laravel 
Php :: from user id to user role wordpress 
Php :: php get current dir mac 
Php :: how to play sound with php 
Php :: laravel collection transform 
Php :: unset session key 
Php :: wordpress get paragraph of content 
Php :: use php variable in html attributes 
Php :: set names utf8 
Php :: iterating rows in php 
Php :: order by in datatable laravel 
Php :: check if index exists in array php 
Php :: PHP Function to create GUID 
Php :: allow json uploads in Wordpress 
Php :: php absolute value 
Php :: do while php 
Php :: laravel 5.8 cors 
Php :: php color generator 
Php :: set laravel local time to indonesia 
Php :: laravel where json contains 
Php :: check number is positive or negative in php 
Php :: How to remove updated_at or use only created_at laravel eloquent ORM 
Php :: curl php 
Php :: how to sum in laravel 
Php :: hiding the extension of website 
Php :: laravel create db 
Php :: taxonomy_get_children drupal 8 
Php :: laravel mass update 
Php :: wp_enqueue_script 
Php :: php compare two arrays of objects 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =