Mysql, Displaying one table data with respect to other table

Wednesday, November 4, 2015

enter image description hereHi all I'm stuck with this problem, I have 2 tables Invoice, Invoice_Lines, I want to display my table in such a fashion that Invoice lines should be displayed below their respective Invoices, here is my code, Please help me that



$queryString = "SELECT * FROM Invoice";
$roql_result_set = RightNow\Connect\v1_2\ROQL::query($queryString);

echo "<table class=\"responstable\"><tr><th>ID</th><th>Account</th><th>Contact</th><th>Display Order</th><th>Date Created</th><th>Date Updated</th></tr>";
while($roql_result = $roql_result_set->next())
{
while ($row = $roql_result->next())
{
$lines = "SELECT * FROM Invoice_lines";
$result_set = RightNow\Connect\v1_2\ROQL::query($lines);
while($result = $result_set->next())
{
while ($line = $result->next())
{
echo "<tr><td><a href=\"#\">" . $line['ID'] ."</a></td><td><a href=\"#\">" . $line['Invoice'] . "</a></td><td>" . $line['Line_Number'] ."</td><td>" . $line['DisplayOrder'] . "</td></tr>";

$ctime = date('F j, Y' , strtotime($row['CreatedTime']));
$utime = date('F j, Y' , strtotime($row['UpdatedTime']));

echo "<tr><td><a href=\"#\">" . $row['ID'] ."</a></td><td><a href=\"#\">" . $row['Account'] . "</a></td><td>" . $row['Contact'] ."</td><td>" . $row['DisplayOrder'] ."</td><td>" . $ctime ."</td><td>" .$utime. "</td></tr>";
}
}

}
}
echo "</table>";

0 comments:

Post a Comment