将数据插入数据库php错误

Be kind, I am still learning, I have made this code but it didn't work, I have tried everything, it is suppose to when an user is logged in and someone send an image the member name is recorded at the database:

if (!isset($_SESSION[sforum_.'sforum_logged_in']));

  if(isset($_SESSION[sforum_.'sforum_user_username'])) {
         mysqli_query(INSERT INTO media (membro) VALUES ('$_SESSION[sforum_.'sforum_user_username']'));
      } else {
         Echo "erro"; 
  } 

It gives an error:

Parse error: syntax error, unexpected T_STRING

Try this code

<?php
    if (!isset($_SESSION[sforum_ . 'sforum_logged_in'])) {
        if (isset($_SESSION[sforum_ . 'sforum_user_username'])) {
            mysqli_query("INSERT INTO media (membro) VALUES ('" . $_SESSION[sforum_ . 'sforum_user_username'] . "')");
        } else {
            echo "error";
        }
    }
?>

You have 2 issues here. You need to quote your SQL in the query, and mysqli_query takes TWO parameters: the connection object link and the sql to run.

mysqli_query($yourDbConnectionString, "INSERT INTO media (membro) 
VALUES ('" . $_SESSION[sforum_ . 'sforum_user_username'] . "')");

Obviously substitute $yourDbConnectionString with the actual value; you didn't include it in the code sample.

if(!isset($_SESSION['sforum_logged_in'])) ;
if(isset($_SESSION['sforum_user_username'])) {
    $query = "INSERT INTO media(membro) VALUES (`" . $_SESSION['sforum_user_username'] . "`)";
    mysqli_query($dbConnect, $query); //$dbConnect is database connected object
}
else {
    echo "erro";
}