Problem with WHILE LOOP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nishmgopal
Forum Contributor
Posts: 101
Joined: Tue Mar 03, 2009 9:38 am

Problem with WHILE LOOP

Post 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??
wellhole
Forum Newbie
Posts: 16
Joined: Mon Mar 23, 2009 1:38 pm

Re: Problem with WHILE LOOP

Post 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.
Post Reply