$sql = "SELECT sid FROM staff WHERE position > 0 ORDER BY name ASC";
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result)):
$staff->getInfo($row['sid']);
echo "<a href='index.php?page=staff&sid=".$staff->sid."'>";
echo $staff->name;
echo "</a>, ";
echo $staff->printPosition();
echo "<br />";
endwhile;
I can display the staff name and position, but when I try to grab the sid for the url - it doesn't work. It just ends up as:
index.php?page=staff&sid=
Any way to solve this?
EDIT:
function getInfo($sid)
{
$sql = "SELECT * FROM staff WHERE sID = '$sid'";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_array($result);
$this->sid = $row['sid'];
$this->branch = $row['branch'];
$this->name = $row['name'];
$this->position = $row['position'];
$this->startDate = $row['startDate'];
$this->div = $row['div'];
$this->tag = $row['tag'];
}