I am using this script to do a vertical scroller on my site. For content, I want to take "new" material from one MySQL table and intersperse it with "new" material from another, so it displays in an alternating fashion like this:
Table 1 Item 1
Table 2 Item 1
Table 1 Item 2
Table 2 Item 2
Table 1 Item 3
Table 2 Item 3
Table 1 Item 4
Table 2 Item 4
I'll paste the queries below in case they're of any help - each query is designed to produce only four items from each table, so the scroller will only have 8 total items. Can someone advise what kind of loop I should be using for this situation? I've only done simple "do while" loops so far, and that is not working here. When I try to put one inside the other, I get no content from the inner loop.
Thank you in advance for any help.
// NEW ITEMS
$query_newitems = "SELECT *, (select max(PubDate) from PubData where PubID=Items.ID group by PubID) as TheDate FROM Items WHERE Items.Publish='Yes' ORDER BY TheDate DESC LIMIT 0,4";
$newitems = mysql_query($query_newitems, $CR) or die(mysql_error());
$row_newitems = mysql_fetch_assoc($newitems);
$totalRows_newitems = mysql_num_rows($newitems);
// NEW RESULTS
$query_newresults = "SELECT * FROM Show_Records, Items WHERE Show_Records.Publish = 'Yes' and Items.Publish = 'Yes' and Show_Records.ID = Items.ID ORDER BY Show_Records.`Date` DESC LIMIT 0, 4";
$newresults = mysql_query($query_newresults, $CR) or die(mysql_error());
$row_newresults = mysql_fetch_assoc($newresults);
$totalRows_newresults = mysql_num_rows($newresults);