jpmarchi 0 Denunciar post Postado Maio 19, 2016 Boa noite, Não tenho muito conhecimento em php e estou tentando rodar um sistema que peguei na internet porém está dando os seguintes erros; Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in D:\VertrigoServ\www\controle_estoque\testar.php on line 19Warning: Cannot modify header information - headers already sent by (output started at D:\VertrigoServ\www\controle_estoque\testar.php:19) in D:\VertrigoServ\www\controle_estoque\testar.php on line 22 <? session_start(); if (!isset($_POST['senha'])){ echo "<script>alert(\"Preencha corretamente!\");history.back(-1);</script>"; exit; } $senha = addslashes($_POST['senha']); $base = mysql_connect('localhost','root','vertrigo'); if (mysql_errno()){ echo "ERRO : " . mysql_errno() . "</body></html>"; exit; } mysql_select_db("redstyle_evolution", $base); $sql = "SELECT * FROM usuarios WHERE senha = '$senha'"; $tabela = mysql_query($sql, $base); $registro = mysql_num_rows($tabela); if ($registro == 0){ header("Location: index.php?errologin=1"); exit; } else { $reg = mysql_fetch_array($tabela, MYSQL_ASSOC); $_SESSION['id'] = $reg['id']; $_SESSION['nivel'] = $reg['nivel']; header("Location: intranet.php"); } ?> Alguem poderia me ajudar/ Compartilhar este post Link para o post Compartilhar em outros sites
ESerra 744 Denunciar post Postado Maio 19, 2016 O erro está antes disto, troque: $tabela = mysql_query($sql, $base); Por: $tabela = mysql_query($sql, $base)OR DIE(mysql_error()); Compartilhar este post Link para o post Compartilhar em outros sites