Monday, 3 September 2018
Subscribe to:
Post Comments (Atom)
alex/bobo/stano
, nothing happens, it does not return any results. Could someone point to me where the problem lies?nume | prenume | id
stano bobo 1
alex bobo 2
// conectare la baza de date
session_start();
$db = mysqli_connect("localhost", "root", "", "inregistrare");
$output = '';
//conectare
if (isset($_POST['cauta'])) {
$cauta1 = $_POST['cauta'];
$cauta1 = preg_replace("#[^0-9a-z]#i","",$cauta1);
$query = mysqli_query($db, "SELECT * FROM users WHERE nume LIKE '%$cauta1%' OR prenume LIKE '%$cauta1%'");
$count = mysqli_num_rows($db, $query);
if ($count == 0) {
$output = 'Nu a fost gasit elevul';
} else {
while ($row = mysqli_fetch_array($query)) {
$nume = $row['nume'];
$prenume = $row['prenume'];
$id = $row['id'];
$output .= '<div>'.$nume.' '.$prenume.'</div>';
}
}
}
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Cauta Elev</title>
</head>
<body>
<form method="post">
<input type="text" name="cauta" placeholder="Cauta Elevul"/>
<input type="submit" value="Cauta"/>
</form>
<?php print("$output"); ?>
</body>
</html>
$output .= '<div>'.$nume.' '.$prenume.'</div>';
Hello Friends! I am Ramana a part time blogger from Hyderabad.
0 comments:
Post a Comment