1
GOOD AFTERNOON. I’m doing a help forum on my website, and I came across a question. I tried to make sure that when the topic owner had the question answered, he himself could close the topic. However, I have a certain message when trying to display the message for it to click. I tried that:
<?php
$connect = mysql_connect('localhost','root','');
$db = mysql_select_db('registro');
$id = $_GET["id"];
$sql = "SELECT `Autor` FROM topicos WHERE `ID` = '$id'";
$limite = mysql_query("$sql");
if ($sql = $login_cookie ) { // o $login_cookie é minha variavel que seleciona o nome de usuário, quando ele está ativo na conta
// então, tentei comparar o nome de usuário com o nome do autor do tópico
echo "Fechar tópico";
} else {
echo "oi"; // mensagem só para certificar se funcionou
}
?>
But I didn’t get any results.
I don’t want a complete code, I just want to know how I could do it, that is, how I could do it.
Well, through this edition, I have come to say that this system would help me in several other functions also in my forum. I forgot to inform also what is happening: By entering this code, the message appears regardless of who is logged in. I don’t know if an image should help, but I believe it shows better what I do: http://i.imgur.com/Xrexho6.png
I will try here and I have already put results. Thank you for the reply, from now on.
– Victor Eyer
It worked great. Thanks, buddy. In short: I needed to take the result of querry, instead of trying to compare the select and by two equal signs in comparison, right?
– Victor Eyer
Yes. Knowing right is important, but it’s also important that you understand what you did wrong. In addition, there are several ways to do this check. This is one of them and even not the most suitable. You can do it all in the same
SELECT
.– Diego Souza
Thank you. Once again
– Victor Eyer