Rebimbas Posted January 24, 2017 at 11:43 AM Report Share #602150 Posted January 24, 2017 at 11:43 AM Fatal error: Call to a member function fetch_array() on a non-object in C:\xampp\htdocs\Site\conectdb\BaseDados\index.php on line 23 Tenho tido este erro apos me registar no site e qaundo vou para fazer o login apos introduzir o email e a pw clico no botão "LOGIN" e enviam-me este erro. A minha linha 23 é esta: $row=$query->fetch_array(); O restante codigo é este: if (isset($_POST['btn-login'])) { $email = strip_tags($_POST['email']); $password = strip_tags($_POST['password']); $email = $DBcon->real_escape_string($email); $password = $DBcon->real_escape_string($password); $query = $DBcon->query("SELECT name, email, password FROM login WHERE email='$email'"); $row=$query->fetch_array(); $count = $query->num_rows; // if email/password are correct returns must be 1 row if ($row['password']) { $_SESSION['userSession'] = $row['user_id']; header("Location: home.php"); } else { $msg = "<div class='alert alert-danger'> <span class='glyphicon glyphicon-info-sign'></span> Invalid Username or Password ! </div>"; } $DBcon->close(); } ?> Gostava imenso que me dessem alguma possível solução para este problema que me atormenta a mesmo muito tempo pois no que toca a php eu n estou la muito in nessa matéria. Link to comment Share on other sites More sharing options...
HappyHippyHippo Posted January 24, 2017 at 11:50 AM Report Share #602151 Posted January 24, 2017 at 11:50 AM vou-te ensinar a pescar : consegues traduzir para portugues a frase :Call to a member function fetch_array() on a non-object IRC : sim, é algo que ainda existe >> #p@p Portugol Plus Link to comment Share on other sites More sharing options...
Moneybag Posted January 25, 2017 at 12:03 AM Report Share #602157 Posted January 25, 2017 at 12:03 AM Vou dar-te um concelho quanto ao teu código, analisa este link http://php.net/manual/en/mysqli.query.php Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now