init
This commit is contained in:
commit
72a26edcff
22092 changed files with 2101903 additions and 0 deletions
34
scripts/ajax/backend-search.php
Normal file
34
scripts/ajax/backend-search.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
//Including Database configuration file.
|
||||
if (isset($_POST['search'])) {
|
||||
//Search box value assigning to $Name variable.
|
||||
$Name = $_POST['search'];
|
||||
//Search query.
|
||||
$Query = $GLOBALS['mysql']->query("SELECT * FROM fazs WHERE name LIKE '%$Name%' OR name2 LIKE '%$Name%'LIMIT 40");
|
||||
//print_r( $Query);
|
||||
echo $con;
|
||||
//Query execution
|
||||
$ExecQuery = MySQLi_query($con, $Query);
|
||||
//Creating unordered list to display result.
|
||||
echo '
|
||||
<ul>
|
||||
';
|
||||
//Fetching result from database.
|
||||
//while ($Result = MySQLi_fetch_array($ExecQuery)) {
|
||||
//while ($Result = MySQLi_fetch_array($Query)) {
|
||||
while($Result = $Query->fetch_assoc()) {
|
||||
?>
|
||||
<!-- Creating unordered list items.
|
||||
Calling javascript function named as "fill" found in "script.js" file.
|
||||
By passing fetched result as parameter. -->
|
||||
<li onclick='fill("<?php echo $Result['name2'].' '.$Result['name']; ?>")'>
|
||||
<a>
|
||||
<!-- Assigning searched result in "Search box" in "search.php" file. -->
|
||||
<?php echo $Result['name2'].' '.$Result['name']; ?>
|
||||
</li></a>
|
||||
<!-- Below php code is just for closing parenthesis. Don't be confused. -->
|
||||
<?php
|
||||
}}
|
||||
?>
|
||||
</ul>
|
||||
Loading…
Add table
Add a link
Reference in a new issue