Forum Moderators: coopster
anyway i query table1 and get results with headings
id, page
i then query table2 and get a table with
id and page
how can i add the rows together (union removed suplicates). I want to do this so i can count the number of occurences of pages. I can do this easy its just the adding of the rows together? any ideas or help maybe a sub or join may work
Thanks
Drew
I dont think i have made this clear,ill elaborate
we have two tables
WEBSITE_HIT and SESSION_HIT
website_hit contain details on the visit_id and the page a user has entered on a website
session_hit is populated with subsequent hits from the same user still detailing page and visit_id. I have sepeated them simply for ease and making a majority of my queries easier to achieve.
i want to have a table with PAGE and VISIT_ID which almost concatonates the rows from WEBSITE_HIT and SESSION_HIT
so if there were 5 rows in hit and 7 rows in session i want 12 rows in my resulting table
Thanks
Drew
couldn't you just do two queries and not add the closing </table> tag till after the querrie was finished?
$result = @mysql_query("SELECT id, other FROM $fromwhere WHERE something = $something);
if (!$result) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
?>
<table class="myTable">
<tr><th>Day</th><th>ID</th><th>Other</th></tr>
<?php
while ($row = mysql_fetch_array($result)) {
echo '<td>' . $row['id'] . '</td>';
echo '<td>' . $row['other'] . '</td>';
echo "</tr>";
}
$result2 = @mysql_query("SELECT id, other FROM $fromwhere2 WHERE something = $something);
if (!$result2) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
while ($row = mysql_fetch_array($result2)) {
echo '<td>' . $row['id'] . '</td>';
echo '<td>' . $row['other'] . '</td>';
echo "</tr>";
}
?>
</table>