Jump to content

Viewing a queries results in a specific way.


fallenangel1983

Recommended Posts

Hey all,

 

I want to view data from 2 tables. both tables have various information in them.

 

They are linked through a column named solID. both tables have equal sol ID's.

 

My problem lies in when i want to view the tables. I dont just want to list them on table after the previous.

 

I want to view them like this:                                                                     

 

 

                TABLE 1

 

firstname       lastname        solID

    bob            smith             1

 

                TABLE 2

 

department    sector            solID

accounts         2                  1

 

                TABLE 1

 

firstname       lastname        solID

    john            walt             2

 

                TABLE 2

 

department    sector            solID

   sales            4                  2

 

etc etc

 

so i can  see the solution id one after the other

 

any help would be appreciated. cheers

 

 

So this is what i got so far

 

echo "<b><center><h1>Archives</H1></center></b><br><br>";

 

$i=0;

while ($i < $num1)

{

 

  echo "<table width='100%' border='1' bgcolor='ffffff'>";

  echo "<tr align='center' valign='middle'>";

  echo "<td align='center' width='7%'><font color='red' size='4'>Event ID</font></td>";

  echo "<td align='center' width='7%'><font color='red' size='4'>Date</font></td>";

  echo "<td align='center' width='7%'><font color='red' size='4'>Username</font></td>";

  echo "<td align='center' width='8%'><font color='red' size='4'>Department</font></td>";

  echo "<td align='center' width='12%'><font color='red' size='4'>Software/Hardware</font></td>";

  echo "<td align='center' width='43%'><font color='red' size='4'>Description</font></td>";

  echo "<td align='center' width='8%'><font color='red' size='4'>Solved Y/N</font></td>";

  echo "<td align='center' width='18%'><font color='red' size='4'>Solution ID</font></td>";

  echo "</tr></table></font>";

 

  $eventID=mysql_result($result1,$i,"eventID");

  $dateStart=mysql_result($result1,$i,"dateStart");

  $username=mysql_result($result1,$i,"username");

  $department=mysql_result($result1,$i,"department");

  $softHard=mysql_result($result1,$i,"softHard");

  $eventDesc=mysql_result($result1,$i,"eventDesc");

  $solved=mysql_result($result1,$i,"solved");

  $solID=mysql_result($result1,$i,"solID");

 

  echo "<table width='100%' border='1' bgcolor='ffffff' align='center'>";

  echo "<tr align='center' valign='middle'>";

  echo "<td valign='middle' align='center' width='7%'>$eventID</td>";

  echo "<td valign='middle' align='center' width='7%'>$dateStart</td>";

  echo "<td valign='middle' align='center' width='7%'>$username</td>";

  echo "<td valign='middle' align='center' width='8%'>$department</td>";

  echo "<td valign='middle' align='center' width='12%'>$softHard</td>";

  echo "<td valign='middle' align='center' width='43%'>$eventDesc</td>";

  echo "<td valign='middle' align='center' width='8%'>$solved</td>";

  echo "<td valign='middle' align='center' width='18%'>$solID</td>";

  echo "</tr></table>";

 

  $ii=0;

  while ($ii < $num2)

  {

 

  echo "<br><br><table width='100%' border='1' bgcolor='ffffff'>";

  echo "<tr align='center' valign='middle'>";

  echo "<td align='center' width='7%'><font color='red' size='4'>Solution ID</font></td>";

  echo "<td align='center' width='8%'><font color='red' size='4'>Username</font></td>";

  echo "<td align='center' width='85%'><font color='red' size='4'>Solution</font></td>";

  echo "</tr></table></font>";

 

  $solID=mysql_result($result2,$ii,"solID");

  $username=mysql_result($result2,$ii,"username");

  $solution=mysql_result($result2,$ii,"solution");

 

  echo "<table width='100%' border='1' bgcolor='ffffff' align='center'>";

  echo "<tr align='center' valign='middle'>";

  echo "<td valign='middle' align='center' width='7%'>$solID</td>";

  echo "<td valign='middle' align='center' width='8%'>$username</td>";

  echo "<td valign='middle' align='center' width='85%'>$solution</td>";

  echo "</tr></table>";

  $ii++;

  }

 

$i++;

}

 

but this brings up all of the 2nd table after each of the 1st table.

 

i know ive yet to get a reply but please guys end my torment!  :D

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.