i have passed multiple identical id values, and now i want to retrieve those corresponding id values in mysql. how do i retrieve them? the table that the ids were inserted is a join table named hrm1_employees with field names hrmemp1Id, empId, and hrm1Id. the field hrm1Id came from the table hrm1, and empId from table employees, each with ids corresponding to their fields (e.g. empId corresponds to the employees Fname, Lname, etc).
question is how do i retrieve the Fname and Lname and projtitle of the ids.
heres my code:
<?php
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "";
$dbname = "smportal";
//Connect to MySQL Server
mysql_connect($dbhost, $dbuser, $dbpass);
//Select Database
mysql_select_db($dbname) or die(mysql_error());
$y=mysql_query("SELECT * FROM hrm1, employee, hrm1_employees WHERE hrm1.hrm1id = hrm1_employees.hrm1id and employee.empId = hrm1_employees.empId");
$display_string = "<table border='2' cellpadding='3'>";
$display_string .= "<tr>";
$display_string .= "<th>Project Title</th>";
$display_string .= "<th>Employees</th>";
//loop here
$display_string .= "<td>$row[projTitle]</td>";
$display_string .= "<tr>";
while($row = mysql_fetch_array($y))
{
//inside while
$display_string .= "<td>$row[Fname]</td>";
$display_string .= "</tr>";
}
echo $display_string;
?>
this code is suppose to display the project title once, and the employees Fname multiple times. as the relationship of project to employees is one to many.
can't figure out the code >.< please help
p.s. i am able to pass the correct id properly, i just don't know how to retrieve them, which in this case, the code above is responsible for.