Galera eu to iniciando meus aprendizados em php com banco de dados mysql, ja consigo fazer conexões e construir minha tabela, mas eu ja procurei por toda a internet, tentei de varias formas, e não consigo achar uma forma de clicar sobre alguma linha na tabela, e ela retornar seus valores, usando php ou javascript. Quem puder me dar uma luz agradeço
Segue meu codigo:
Lorren function mostrar(){ var form = document.getElementById("formulario"); var geral = document.getElementById("geral"); if (form.style.display == "block"){ form.style.display = "none"; geral.style.opacity = 1;}else{ form.style.display = "block"; geral.style.opacity = 0.4; } } </script> <body><div id="geral"> <div id="top"> <h1>Lorren</h1> <button onclick="location.href='index.php'">Sair da sessão</button> </div> <div id="user"> <?php session_start(); $nome = $_POST['nome']; $matricula = $_POST['matri']; $servername = "localhost"; $username = "root"; $password = ""; $banco = "biblioteca2"; $verificar = "SELECT * FROM Aluno where Nome = '$nome' and id_aluno='$matricula'"; $conn = new mysqli($servername, $username, $password,$banco); mysqli_set_charset($conn,"utf8"); $result = mysqli_query($conn, $verificar); $linha = mysqli_num_rows($result); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } echo "<br/>Connected successfully <br/>"; if($linha == 1){ echo "Usuario: ".$nome."<br/>Matricula: ".$matricula; }else{ header('Location: index.php'); exit(); } ?> </div> <div id="tabela"> <?php $livros = "SELECT id_livro,Titulo FROM livros"; $resultlist = mysqli_query($conn, $livros); $linhalivro = mysqli_num_rows($resultlist); if($linhalivro>0){ echo "<table id='table'>"; while($linhalivro = mysqli_fetch_assoc($resultlist)){ echo"<tr> <td>".$linhalivro['id_livro']." </td><td onclick='alertar('table')'>".$linhalivro['Titulo']." </td></tr>"; } echo '</table>'; } ?> </div> </div> </body> <script> </script>