Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

MySQLi not updating with query

I'm making a simple social application.

In this test app you have the ability to update your information.

All variables and input names are correct but for some reason it does not update the databse.

<?php

session_start();

include "dbh.php";

$fname = $_POST['fname'];
$email = $_POST['email'];
$year = $_POST['year'];
$about = $_POST['about'];
$gender = $_POST['gender'];
$interests = $_POST['interests'];
$organizations = $_POST['organizations'];
$id = $_SESSION['id'];

$sql = "UPDATE users SET fname='$fname', email='$email', year='$year', about='$about', gender='$gender', interests='$interests', organizations='$organizations' WHERE id='$id'";
$result = $conn->query($sql);

header("Location: profile.php?success=updated");

So as you can se, I am using an incorrect way of running the result but that should not effet the result anyway. Any suggestions? If you find a solution I thank you a lot for posting your solution! Thanks!