7. PHP MySQL - Search

Telechargé par Kawthar Mtawaa
view.php
AddressBook
PHPandMySQL
default.html insert.php
delete.phpedit.phpupdate.php
conn.php search.php
mydb
user
id
user_name
user_email
user_phone
<form action="search.php"method="post">
<input type="text" name="search_key"/> <input type="submit" value="Search"/>
</form>
<?php
include("conn.php");
$search_key =isset($_POST['search_key']) ?$_POST['search_key'] : '';
if ($search_key == NULL)
{
echo "Pleaseenteryoursearchkey";
}
else
{
$result =mysqli_query($con,"SELECT *FROMuserWHEREuser_name LIKE'%" .$search_key ."%'");
?>
<br/>
<table width="50%">
<tr bgcolor="#CC99FF">
<td>Name</td>
<td>Email</td>
<td>PhoneNumber</td>
<td>Edit</td>
<td>Delete</td>
</tr>
search.php
Continuenextpage>>
<?php
while($row =mysqli_fetch_array($result))
{
echo "<tr bgcolor=\"#99FF66\">";
echo "<td>";
echo $row['user_name'];
echo "</td>";
echo "<td>";
echo "<ahref=\"mailto:" .$row['user_email']. "\">".$row['user_email'] . "</a>";
echo "</td>";
echo "<td>";
echo $row['user_phone'];
echo "</td>";
echo "<td><ahref=\"edit.php?id=".$row['id']."\">Edit</a></td>";
echo "<td><ahref=\"delete.php?id=".$row['id']."\"onClick=\"returnconfirm('DeleteThis
account?');\">Delete</a></td>";
echo "</tr>";
}
mysqli_close($con);
}
?>
</table>
search.php
SampleOutput
SampleOutput
1 / 5 100%

7. PHP MySQL - Search

Telechargé par Kawthar Mtawaa
La catégorie de ce document est-elle correcte?
Merci pour votre participation!

Faire une suggestion

Avez-vous trouvé des erreurs dans linterface ou les textes ? Ou savez-vous comment améliorer linterface utilisateur de StudyLib ? Nhésitez pas à envoyer vos suggestions. Cest très important pour nous !