Fetch data store in session and move on another page

No idea about those unless you can show the lines that they relate to, and a few lines before them.

the main problem is after verify password fetch first name based on email and password

Is this anything to do with the filename? Perhaps your local system deals with %20- in a different way to your live system, or perhaps the live is case-sensitive and the local is not?

As before, though, it looks like you’re trying to use the results of a query without checking whether the query (or something before it) worked. You’re passing a results object into something, and the results object is null, hence the error.

I’m confused by this code. You seem to set $first_name twice, once via trim() and then, on the next line, without the trim(). Then you re-assign it back into the $row array for some reason. All of this is after you’ve redirected to another page.

Then on the second page, you are accessing the $_POST array. Is this because it’s a form submission from somewhere else? If it’s from your redirect in the first page code, then $_POST won’t exist (which you should check for) because you’ve just done a redirect, not a HTTP POST.

On the second page again, you set a session variable to $first_name, but you haven’t defined that anywhere, unless you have missed that out for the post. You also didn’t include it in the query.

put in code that so i can try

   
<?php
	
	$mysqli = new mysqli("");

/* check connection */
if ($mysqli->connect_errno) {
    printf("Connect failed: %s\n", $mysqli->connect_error);
    exit();
}
	


$query = "SELECT first_name FROM  users where email = '".$email."'";

if ($result = $mysqli->query($query)) {

    /* fetch associative array */
    while ($row = $result->fetch_assoc()) {
    echo  $row["first_name"];
	$_SESSION['reply'] = $row['from'];
    $username2 = $_SESSION['reply'];`
	
	
    }

    /* free result set */
    $result->free();
}

/* close connection */
$mysqli->close();

?>

I have an error here where is $mysqli->close(); any help

Do you want to give us a clue as to what the error actually says?

:smile: i fixed maybe will be another problem how if someone click paypal button send on email confirmation.

This bit won’t be right, surely?

$_SESSION['reply'] = $row['from'];

You don’t retrieve that column in your query.

echo $_SESSION[‘first_name’] = $row[first_name];

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.