Hi folks,
one of the web systems at work has provided a strange bug, which I'm hoping someone here will have come across before. The system's been running fine, and without a hitch for the last 3 years, but all things eventually come to an end...
On one of the forms a drop down list has just stopped populating, sort of. When I view it, it's fine and is populated as it should. But other users have mentioned the same problem, so something must be up - except when I login with their details it's fine.
I think the problem may be something to do with the session that's being used to populate the drop down list, but I can't figure it out. Has anyone come across a similar problem?
The part of the code which I think is causing the problem is this:
if($_SESSION['SESSION']=="admin"){
$query_username = "select username from users";
}
else{
$query_username = "select username from users where username = '" . $_SESSION['SESSION'] . "'";
}
$query_result = mysql_db_query($Database,$query_username);
for ($i=1; $i<=mysql_num_rows($query_result); $i++)
{ $object_user = mysql_fetch_object($query_result);
if($object_user->username != "admin"){
if($object_user->username == $_POST['Responsible']){
echo "<option value=\"".$object_user->username."\" SELECTED>".$object_user->username."</option>\n";
}
else{
echo "<option value=\"".$object_user->username."\" >".$object_user->username."</option>\n";
}
}
}
cheers for taking a look,
Rob.