This is my code, but I don't know where is the error.
It says that I got error which is Notice:
Undefined index: ic in C:\xampp\htdocs\fyp\profile.php on line 57.
<?php
include_once("config.php");
$ic = $_SESSION['ic'];//-----------------------------------this is line 57
$sql = "SELECT * FROM studentprofile WHERE ic = '$ic'";
$result = mysql_query($sql,$conn);
while($row = mysql_fetch_array($result))
{
$id = $row['id'];
$ic = $row['ic'];
$name = $row['name'];
$course = $row['course'];
$faculty = $row['faculty'];
$address = $row['address'];
$hpno = $row['hpno'];
$gender = $row['gender'];
$email = $row['email'];
?>
<table width="70%" height="80%" border="1" align="center">
<tr>
<th>ID</th>
<td><?php echo $id;?></td>
</tr>
<tr>
<th>IC No</th>
<td><?php echo $ic;?></td>
</tr>
<tr>
<th>Name</th>
<td><?php echo $name;?></td>
</tr>
<tr>
<th>Course</th>
<td><?php echo $course;?></td>
</tr>
<tr>
<th>Faculty</th>
<td><?php echo $faculty;?></td>
</tr>
<tr>
<th>Address</th>
<td><?php echo $address;?></td>
</tr>
<tr>
<th>Handphone No</th>
<td><?php echo $hpno;?></td>
</tr>
<tr>
<th>Gender</th>
<td><?php echo $gender;?></td>
</tr>
<tr>
<th>Email</th>
<td><?php echo $email;?></td>
</tr>
</table>
<?php
}
?>
I want to try to put isset. But I don't know how. I already try delete the include_once("config.php") to include("config.php").. but nothing happened.
I already start the session in the php. Can anyone help me to find what is wrong with my coding?
This coding is for view the profile of person who already login into the system. for example, I login into the system and when i view profile, only my profile will be display. therefore, I try to use the code that I post earlier.
But it is error. I already set my ic attribute in the database as primary key.