hi guys need some help its just a small miss out im sensing i have an update profile code for users and its working fine im applying the same code for different user like for NGO users profile but it just echoin NO column found even thou i have the table for ngo users ;(---------->)look for this arrow please help
<?php
include 'session.php';
if(!isset($_SESSION['login_user']))
{
header("location:login.php");
}
$user_check = $_SESSION['login_user'];
$update1=$_POST['fname'];
$update2=$_POST['ngo'];
$update3=$_POST['email'];
$update4=$_POST['address'];
$link=mysqli_connect("localhost","root","","sysp");
if($link===false)
{
die("error cant connect".mysqli_connect_error());
}
if (isset($_POST['submit']))
{
$update1=$_POST['fname'];
$update2=$_POST['ngo'];
$update3=$_POST['email'];
$update4=$_POST['address'];
}
$query="SELECT fname,ngo,email,address, FROM ngo WHERE email='$user_check' ";
$result=mysqli_query($link,$query);
if(!$result)
{
echo"no column found";---------->Main problem
}
else{
//----------------------------First Name update--------------------------------//
if($_POST['fname']==$update1)
{
$sql="UPDATE ngo SET fname='$update1' WHERE email='$user_check' ";
$res = mysqli_query($link, $sql); // ** actually run the query
if ($res){ echo"Updated successfully";
} else {
echo"Didnt update ";
}
}
//--------------------------------------end---------------------------------------------------//
//----------------------------NGO name update--------------------------------//
if($_POST['ngo']==$update2)
{
$sql="UPDATE ngo SET ngo='$update2' WHERE email='$user_check' ";
$res = mysqli_query($link, $sql); // ** actually run the query
if ($res){ echo"Updated successfully";
} else {
echo"Didnt update ";
}
}
//--------------------------------------end---------------------------------------------------//
//----------------------------Email update--------------------------------//
if($_POST['email']==$update3)
{
$sql="UPDATE ngo SET email='$update3' WHERE email='$user_check' ";
$res = mysqli_query($link, $sql); // ** actually run the query
if ($res){ echo"Updated successfully";
} else {
echo"Didnt update ";
}
}
//--------------------------------------end---------------------------------------------------//
//----------------------------ADDRESS update--------------------------------//
if($_POST['address']==$update4)
{
$sql="UPDATE ngo SET address='$update4' WHERE email='$user_check' ";
$res = mysqli_query($link, $sql); // ** actually run the query
if ($res){ echo"Updated successfully";
} else {
echo"Didnt update ";
}
}
}
//--------------------------------------end---------------------------------------------------//
mysqli_close($link);
?>