No data to display

So it will never match with the form entry then. But that doesn’t explain why it didn’t match when you were checking first_name.

so how going to match

You could use password_verify() if you’ve used the corresponding function to hash the passwords in the first place. What did you use to store them with?

The other thread you were talking about this in: Log in need to check password - #17 by capljina2

$options = array("cost"=>4);
		$hashPassword = password_hash($password,PASSWORD_BCRYPT,$options);
	

	 	



 $email= trim($_POST['email']);
	$password = trim($_POST['password']);
	
	$sql = "select 	email,password from users where email = '".$email."'";
	$rs = mysqli_query($conn,$sql);
	$numRows = mysqli_num_rows($rs);
	
	if($numRows  == 1){
		$row = mysqli_fetch_assoc($rs);
		if(password_verify($password,$row['password']))
		{
		$_SESSION["user_id"] =$email;
		
			echo'<script>window.location="http://localhost/carbooking3/16%20y/S.php";</script>';	
		}
		else{
		echo'<script>window.location="http://localhost/carbooking3/16%20y/S%20-%20Copy.php";</script>';	  
    
  
	}
	}
 }	Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /home/kosilice/public_html/suad.php on line 34

i needed to fix warning and after verify password can fetch first name where is password and email in

What warning?

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /home/kosilice/public_html/suad.php on line 34

And which is line 34?

$numRows = mysqli_num_rows($rs);

OK, that means the query didn’t execute, so instead of returning a results object in $rs, it returned false. You should check that queries have not returned false before you try to use the results.

I can’t see anything wrong with the query from what you posted (as long as the email doesn’t have a ' character in it, of course), is the connection to the database good?

i am so tired of it

Debugging is just going through each line, one by one, until you find out what caused the problem. Your query isn’t executing for some reason, so it has to be either the query itself (which looks OK), or the connection to the database. As I can’t see the database connection code, you should check that first. Presumably when you connect to the database, you check to see whether it worked - if you don’t, then start checking. Also you should start checking to see whether your query works, before you start trying to use the results. That would probably help give you some pointers on where any errors happen.

But basically, go through it step by step, logically, until you see what’s wrong. That’s all you or anyone can do.

hej
i have live site from friend

http://kosilice.ba/suad.php

check

What am I looking at, and for?

for warning up

It just shows the same warning that you’ve already told me about though - I can’t see your PHP source or database contents to figure out why it’s failing. Only you can do that, unless you post all the code here.

<?Php session_start();?> 


<?php 
    	if (isset($_POST['Submit1'])) {
	
		$conn= mysqli_connect("","",""); 
	if(mysqli_connect_error()) { 
		die('Could not connect: ' . mysqli_connect_error());
	}
	$conn->select_db('');
	
	
	
	
	
	
	
	$options = array("cost"=>4);
		$hashPassword = password_hash($password,PASSWORD_BCRYPT,$options);
	

	 	



 $email= trim($_POST['email']);
	$password = trim($_POST['password']);
	
	$sql = "select 	first_name,email,password from users where email = '".$email."'";
	$rs = mysqli_query($conn,$sql);
	$numRows = mysqli_num_rows($rs);
	
	if($numRows  == 1){
		$row = mysqli_fetch_assoc($rs);
		if(password_verify($password,$row['password']))
		{
		$_SESSION["user_id"] =$email;
		$_SESSION["first_name"] =$first_name;
			echo'<script>1</script>';	
		}
		else{
		echo'<script>11</script>';	  
    
  
	}
	}
	
	
	$conn->close();
	
	
	
	
	
?>
                               
                                    
                                  
   </td>                                 
                                    </tr>
								</tbody>
						  </table>
                        </div>
                        <div class="wrapper">
                        
                         <div style="witdh: 100%; ">
                            <div class="htitel"><h2 class="fl" style="border:0; margin:0;">Customer Details</h2></div>
                            <!-- start of search row --> 
                            <div class="container-fluid" style="margin:0; padding:0;">
                                <div class="row-fluid" style="background-color: #faac59; padding: 1% 0">
                                  <div class="span12">
                                    	<h3 style="margin-left:2.3%"><DIV align="left">Existing Customer? </div></h3></br>
                                        
                                        <form class="form-horizontal" action="" method="post" id="form1" style="width: 95%; margin: 0 2.5%" novalidate>
                                            <div class="control-group">
                                              <label class="control-label" for="ea">Email Address:</label>
                                                <div class="controls">
                                                      <DIV align="left">  <span id="sprytextfield18"><span id="sprytextfield19">
                                                      <input type="text" name="email" id="email">   <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
                                                      <span class="textfieldRequiredMsg">A value is required.</span></span>
                                                    
                                                           <span class="textfieldRequiredMsg">A value is required.</span></span></div>
                                                </div>  <span class="textfieldRequiredMsg">A value is required.</span></span></td>
                                                 </br>     
                                                     
                                            </div>
                                            <div class="control-group">
                                                <label class="control-label" for="pa">Password:</label>
                                                <div class="controls">
                                                    <DIV align="left"><span id="sprytextfield15">
                                                      <input type="text"  name="password" id="password" class="input-large valid">
                                                  <span class="textfieldRequiredMsg">A value is required.</span></span></div>
                                                </div>  <span class="textfieldRequiredMsg">A value is required.</span></span></td>
                                            </div>
                                  <div class="control-group">
                                                <div class="controls" id="exist_wait"></div>
                                  </div>
                                              
                                            <div class="control-group">
                                                <label class="control-label"></label>
                                                <div class="controls">
                                                  <tr valign="baseline">
                                                <td nowrap align="right">&nbsp;</td>
                                                <td> <DIV align="left"><input type="submit" name="Submit1" class="submit" value="Submit"></div></td>
                                              </tr>
                                    </form>

don’t understand
$_SESSION[“user_id”] =$email;

i can get from db and put in session why other cant

Sorry, I don’t know what you’re asking there.

A cost of 4 is low, I would recommend at least 10.

1 Like