Created
February 10, 2017 20:14
-
-
Save ityulkanov/526a4e192e897c178f73594e3401a962 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php include ("db.php"); ?> | |
<?php | |
mysqli_set_charset($connection, "utf8"); | |
$search = $_POST['search']; | |
if (!empty($search)) { | |
$query = "SELECT * FROM records WHERE phone LIKE '$search%' "; | |
$search_query = mysqli_query($connection, $query); | |
$num_rows = mysqli_num_rows($search_query); | |
?><p><?php echo "<span id='results'>Результатов: {$num_rows}"; ?> </p> | |
<?php | |
if (!$search_query) { | |
die('QUERY FAILED' . mysqli_error($connection)); | |
# code... | |
} | |
while($row = mysqli_fetch_array($search_query)) { | |
// get data from each row to display it in the results | |
$phone = $row['phone']; | |
$description = $row['description']; | |
$date_added = $row['date_added']; | |
$id = $row['id']; | |
?> | |
<?php | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment