Dear readers,
I am using PHP and MySQL to develop Student Database. I have the following two files.
file1.php
.....
$server = mysql_connect("localhost", "", "");
$data = mysql_select_db ("student");
$query = "select * from student";
$result = mysql_query($query);
while($record= mysql_fetch_object($result)){
echo "<a href = "\file2.php?ID =".$record->StudentID."\">Edit</a> ..........
}
There is no problem in the above code, as i can see the value of ID which is the value of '$record->StudentID' from the database for each student. Now the problem comes in the second file:
file2.php
....
$get = $HTTP_GET_VARS['ID'];
$server = mysql_connect("localhost", "", "");
$data = mysql_select_db ("student");
$query = "select * from student where StudentID like '$get'";
$result = mysql_query($query); ..........
The variable $get returns nothing.
The StdentID in student table is defined as varchar. What is wrong or what should I do to solve this problem?
Hopping to get help soon,
Solomon