1
I have a database of people, the name of my db and Register and in it I have a table users with four columns already filled id, age, name and email i am developing a user search system here is the search page
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form action="" method="GET" >
<input type="text" autocomplete="on" name="q" placeholder="Digite a sua pesquisa" />
<input type="submit" value="Tecle Enter" />
</form>
<?php
$host = 'localhost';
$user = 'devel';
$password = '********';
$database = 'Cadastro';
$connect = mysqli_connect($host, $user, $password, $database) or die("conexao die");
$query = $_GET['q'];
if(isset($query)){
$consult = mysqli_query("SELECT nome FROM 'usuarios' WHERE 'nome' LIKE %q%", $connect);
$result = mysqli_fetch_assoc( $consult );
print_r($result);
}
else {
echo 'nao foi encontrado nada';
}
?>
</body>
</html>
but I’m not getting feedback is there any way to know if the query was successful as I think my error is in the $consult
I am completely lay in Mysql
remembering I am wanting to retrieve the column name of my db referring to my GET
– user45474
Print 'found nothing'? What prints?
– Miguel
the GET parameter is sent but it is not printing me anything
– user45474
Sent as? Do not print anything on the page? Show how you are doing, url where you are trying to remove the parameter
– Miguel
I put a print on the question see @Miguel
– user45474
What do you print? Print nothing?
– Miguel
Then right wouldn’t post not? or there’s nothing to post and get?
– user45474
In this case it’s fine, it’s $_GET['q']... But don’t print anything? Do it there
echo $_GET_['q'];
– Miguel
GET parameter is printing but query is not responding
– user45474
Try the connection parameter first($connect,"SELECT .....)
– MagicHat
and maybe, $Consult="SELECT...." ; $result=mysqli_query($connect,$Consult); and ai $Row=mysqli_fetch_assoc($result); print_r($Row);
– MagicHat
I tried too now and nothing
– user45474
Try that last landing, I sent, in the comments..
– MagicHat
now returned was not found anything @Magichat
– user45474
@Nikobellic Hey bro, Funfou?
– MagicHat
funfo vlw @Magichat
– user45474
I edited the question because "phpmyadmin" is not a "database", read this to understand the differences: What is the difference between mysql and phpmyadmin?
– Guilherme Nascimento