Jump to content

Recommended Posts

Hi Guys,

 

Below is part of my code, and I wanted to know how I can display the results as a html table with Job_Name, Skill_Name, Person Name, Skill_Name and Total as the columns

 

$sql= "SELECT
     Person_ID.Person_Name, Person_Skill.Skill_name, (Person_Skill.Score-ID_Table.Weight) AS total, Job_ID.Job_Name, ID_Table.Skill_Name
FROM
     Job_ID
     JOIN ID_Table
        USING (Job_ID)
     JOIN Person_Skill
         USING (Skill_Name)
     JOIN Person_ID
         USING (Person_ID)
  ORDER BY
     total
DESC";

$result = mysql_query($sql)
  or die ("Couldn't execute query.");

while ($row=mysql_fetch_array($result))
{
       
}

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/150598-displayin-results-of-sql-query/
Share on other sites

I tried this:

 

$sql= "SELECT
     Person_ID.Person_Name, Person_Skill.Skill_name, (Person_Skill.Score-ID_Table.Weight) AS total, Job_ID.Job_Name, ID_Table.Skill_Name
FROM
     Job_ID
     JOIN ID_Table
        USING (Job_ID)
     JOIN Person_Skill
         USING (Skill_Name)
     JOIN Person_ID
         USING (Person_ID)
  ORDER BY
     total
DESC";

$result = mysql_query($sql)
  or die ("Couldn't execute query.");
while ($row=mysql_fetch_array($result))
{
    $tblRows .= "<tr>";
$tblRows .= "<td>{$row['Job_Name']}</td>";
    $tblRows .= "<td>{$row['Skill_Name']}</td>";
    $tblRows .= "<td>{$row['Weight']}</td>";
$tblRows .= "<td>{$row['Score']}>/td>";
    $tblRows .= "</tr>\n";
  
  }

echo "<table width=\"200\" border=\"1\">\n";
echo "<tr><th>Job_Name</th><th>Skill</th><th>Weight</th></tr>\n";
echo "$tblRows";
echo "</table>\n";

 

and i got:

 

Job_Name Skill Weight

Manager Java >/td>

Manager Java >/td>

Manager C >/td>

Manager C# >/td>

 

 

But I want the Job Name, Person Name, Skill Name, Weight and Score...

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.