Quote:This is the problem: Warning: mysqli_num_row expects parameter 1 to be mysqli_result, bool given on line 27 I Have something againts the SQL injetion in js
<?php session_start(); if(isset($_SESSION['nombredelusuario'])) { header('location: home.php'); } if(isset($_POST['ingre'])) { $dbhost="localhost"; $dbuser="root"; $dbpass=""; $dbname="clini"; $conn=mysqli_connect($dbhost,$dbuser,$dbpass,$dbname); if(!$conn) { die("No hay conexión: ".mysqli_connect_error()); } $nombre=$_POST['name']; $pass=$_POST['pass']; $query=mysqli_query($conn,"Select * from clini where name = '".$nombre."' and pass = '".$pass."'"); $nr=mysqli_num_rows($query); HERE IS THE PROBLEM if(!isset($_SESSION['nombredelusuario'])) { if($nr == 1) { $_SESSION['nombredelusuario']=$nombre; header("location: home.php"); } else if ($nr == 0) { echo "<script>alert('Usuario no existe');window.location= 'login.php' </script>"; } } } ?>
$query
FALSE
mysqli_query
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)