Member Avatar for Ben_718

Hello, so as the title says, I'm looking to include a Session Variable into a MySQL Update statement. I'm not exactly sure what I'm doing wrong, but I certainly know I am. I'm also fairly new to this, so that may explain it lol! Thanks in advance for your help.

Code:
In the original PHP:

$email = $conn->query("SELECT email FROM memberapplications WHERE ID = " . $_GET["appid"]);
$_SESSION["email"] = $email;

In a redirect PHP:
//There is also connections and stuff above and below, but I don't wanna bore you with that.

$sql = "UPDATE users SET appstatus='2' WHERE email='$email'";

The best way to think about this is to try to think about what you’re trying to accomplish, line by line. And then write the syntax for it.

Can you please explain what the code you wrote above is trying to accomplish? What are you trying to do?

I think you’re probably meaning to do

$email = $_SESSION["email"];

And not the other way around.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.