baseline 7.4 as-is produzione
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
␍
|
||||
<?php␍
|
||||
if (session_status() == PHP_SESSION_NONE) {␍
|
||||
session_start();␍
|
||||
}␍
|
||||
␍
|
||||
//Including Database configuration file.␍
|
||||
include "../db.php";␍
|
||||
$iduserlog=$_SESSION["iduserlogin"];␍
|
||||
//Getting value of "search" variable from "script.js".␍
|
||||
if (isset($_POST['companynamevalue'])) {␍
|
||||
//Search box value assigning to $Name variable.␍
|
||||
$Name = $_POST['companynamevalue'];␍
|
||||
//Search query.␍
|
||||
$Query = "SELECT DISTINCT contacts.companyname FROM contacts LEFT JOIN `trf-details` ON `trf-details`.idtrfdetails=contacts.idtrf WHERE contacts.companyname LIKE '%$Name%' AND `trf-details`.iduser='$iduserlog' LIMIT 5";␍
|
||||
//Query execution␍
|
||||
$ExecQuery = MySQLi_query($conn, $Query);␍
|
||||
//Creating unordered list to display result.␍
|
||||
echo '␍
|
||||
<ul>␍
|
||||
';␍
|
||||
//Fetching result from database.␍
|
||||
while ($Result = MySQLi_fetch_array($ExecQuery)) {␍
|
||||
?>␍
|
||||
<!-- 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['companyname']; ?>")'>␍
|
||||
<a>␍
|
||||
<!-- Assigning searched result in "Search box" in "search.php" file. -->␍
|
||||
<?php echo $Result['companyname']; ?>␍
|
||||
</li></a>␍
|
||||
<!-- Below php code is just for closing parenthesis. Don't be confused. -->␍
|
||||
<?php␍
|
||||
}}␍
|
||||
?>␍
|
||||
</ul>
|
||||
Reference in New Issue
Block a user