0
$query = "UPDATE  $abc_tbl ".
    "SET nationality={$_SESSION['Nationality']},".
    "gender={$_SESSION['gender']} ,".
    "dob={$_SESSION['DoB']},".
    "contact={$_SESSION['contact']},".
    "address='{$_SESSION['address']},".
    "level={$_SESSION['Level']},".
    "course={$_SESSION['Course']},".
    "mode_study={$_SESSION['ModeStudy']},".
    "semester={$_SESSION['Semester']},".
    "degree={$_SESSION['Degree']},".
    "major={$_SESSION['Major']},".
    "gpa={$_SESSION['GPA']},".
    "inst={$_SESSION['Institution']},".
    "docs=$target_file)".
    "WHERE (uname=$uname)";

$result=mysql_query($query) or die ("this stuffedup"); 

if ($result) {
    $_SESSION['success'] = "Done";
    header("location: Application_Success.php"); // Redirecting to success page 
}

I tried several syntaxes but still the query is not working

Please kindly I don't know why the information is not stored in my table

Thank you

John Slegers
  • 45,213
  • 22
  • 199
  • 169
salim
  • 1

2 Answers2

0

You need to wrap text value within quote. eg.

 $query = "UPDATE  $abc_tbl ".
          "SET nationality='{$_SESSION['Nationality']}',".
           "gender='{$_SESSION['gender']}',".

 .....
 .....

But you should use some better options like mysqli or PDO as recommend by @Niet the Dark Absol

Use prepared statements and parameterized queries service like mysqli/PDO etc will help you secure your DB from vulnerability like SQL Injection and so on.

Community
  • 1
  • 1
thecodeparadox
  • 86,271
  • 21
  • 138
  • 164
0

Just initialize your session variables into normal php variable then pass them into sql query.

$gender=$_SESSION['gender'];
$DoB=$_SESSION['DoB'];
$Nationality=$_SESSION['Nationality'];
query = "UPDATE  $abc_tbl ".
        "SET nationality=' $Nationality',".
           "gender= '$gender' ,".
           "dob=$DoB,".
           " .......
           ".
           "docs='$target_file' ".
           "WHERE (uname='$uname')"; 

// ....... means finish up your query in a given order

this should work

Fas M
  • 429
  • 2
  • 11