$selectedItem = mysql_escape_string($_POST['select']);
$id= mysql_escape_string($_POST['id']);
if ($selectedItem == "ID")
{
echo 2;
$nome = mysql_query("SELECT nome FROM `eventos` WHERE ID = '$id'");
echo $nome;
}
Ok, i want to show the name of one event of id that i insert in textbox. It shows me 2, so if statement is working but when i say to show nome show me: 2Resource id #5
I have one row in table eventos with id = 1 and i put always in textbox number 1.
Why it doesnt show me the text that i have in collumn nome?
try this
$n = mysql_fetch_array($nome);
echo $n['nome'];
It's recommended to use mysqli_query instead of mysql_query
like this
//
$nome = mysqli_query("SELECT nome FROM `eventos` WHERE ID = '$id'");
$n = mysql_fetch_array($nome);
echo $n['nome'];