Page 1 of 1

Problem with WHILE LOOP

Posted: Tue Mar 24, 2009 6:55 am
by nishmgopal
Hi

This is my code:

Code: Select all

 
$sql= "SELECT Person_Skill . * , ID_Table . * , Job_ID.Job_Name
FROM Person_Skill, ID_Table
JOIN Job_ID
USING ( Job_ID )
WHERE Job_Name='Manager'";
 
$result1 = mysql_query($sql) or die ("Couldn't execute query.");
 
 
while ($row=mysql_fetch_array($result1))
{
 echo "Job Name: ".$row['Manager'] . " ";
 
 }
 
 
?>
 
 
 
 
But the out put is
Job Name:ManagerManagerManagerManagerManagerManagerManagerManager

I was expecting:

Job Name: Manager...

What do i need to change??

Re: Problem with WHILE LOOP

Posted: Tue Mar 24, 2009 12:44 pm
by wellhole
Your join is wrong. If you're going to associate a person with a skill and a job, then put in the conditions for such. Put in how the person is associated with the skill and how the person associates with the job.