Gfer Posted September 24, 2008 Share Posted September 24, 2008 Hey there, I need some help with my php script. It's designed to put in entries/links under a headline which is the day they were added into the database. So it looks like this for example: 2008-09-25 entry4 2008-09-24 entry3 entry2 entry1 and so on, however my problem is that I can't figure out a way to put a </div> where the entries stop for the day. I wan't it to be so that I can manipulate all the entries for one day seperately and so on. Here's my code. $olddate= ""; ?> <div class="holder2"> <?php while($row = mysql_fetch_array($result)) { list($id, $rubrik, $embedurl, $lankurl, $klick, $date, $tid, $kat, $tipsare) = $row; $qcount = mysql_query("SELECT * FROM kommentarer where nid='".$row['id']."'"); $scount = mysql_num_rows($qcount); if($olddate != $date) { $olddate = $date; ?> <div class="dateholder"><p><?php echo $date; ?></p></div> <?php } // end if ?> <div class="linkholder"> <ul> <?php if($embedurl != '') { ?> <li><a href="lank.php?id=<?php echo $id; ?>" target="_blank"><?php echo $rubrik;?></a></li> <?php } else { ?> <li><a href="redir.php?id=<?php echo $id; ?>" target="_blank"><?php echo $rubrik;?></a></li> <?php } ?> <li><small><?php echo $tid;?></small></li> <li><a href="#" onClick="window.open('kommentar.php?id=<?php echo $id; ?>','mywindow','width=350,height=400')"><?php echo $scount;?> Inlägg</a></li> <li>Klick: <?php echo $klick;?></li> <li>Kategori: <?php echo $kat;?></li> <li>Tipsare: <?php echo $tipsare;?></li> <li>Rating: <?php echo rating_bar($id,'5'); ?></li> </ul> </div> <?php } } ?> Link to comment https://forums.phpfreaks.com/topic/125702-need-help-with-link-script/ Share on other sites More sharing options...
rarebit Posted September 24, 2008 Share Posted September 24, 2008 store the last date, if new date is diff, then it's new section time Link to comment https://forums.phpfreaks.com/topic/125702-need-help-with-link-script/#findComment-649960 Share on other sites More sharing options...
Gfer Posted September 24, 2008 Author Share Posted September 24, 2008 That's what I done for the links inside the headline, I need to close them all up when the new date comes with a </div>. Do I need to save another variable as $olddate2? I want to create a holder for each day so that I can manipulate every day with all the links independantly. Link to comment https://forums.phpfreaks.com/topic/125702-need-help-with-link-script/#findComment-649963 Share on other sites More sharing options...
rarebit Posted September 25, 2008 Share Posted September 25, 2008 basically, but probably a date div which encapsulates the day divs... Link to comment https://forums.phpfreaks.com/topic/125702-need-help-with-link-script/#findComment-649970 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.