Jump to content

Split into day


cordoprod

Recommended Posts

<?
          $db = new DbConnector();
	  $db->connect();
	  
	  $sql = "SELECT * FROM travek_logg GROUP BY time SORT BY time DESC";
	  $result = $db->query($sql);
	  
	  while($fetch = mysql_fetch_array($result)) {
	     
	  }
	  
	  ?>

 

Now i don't have a clue... and am pretty sure the query is wrong..

Link to comment
https://forums.phpfreaks.com/topic/107230-split-into-day/#findComment-549780
Share on other sites

<?
          $db = new DbConnector();
	  $db->connect();
	  
	  $sql = "SELECT * FROM travek_logg GROUP BY time ORDER BY time DESC";
	  $result = $db->query($sql);
	  
	  $day = "yes";
	  while($fetch = mysql_fetch_array($result)) {
	  if($day != "no") date("l", $fetch['time']);
	      echo "<br>".$fetch['nick'];
		  
		 $day = "no";
	  }
	  
	  ?>

 

The output will be:

glenn

heihei

 

- No day...

Link to comment
https://forums.phpfreaks.com/topic/107230-split-into-day/#findComment-549796
Share on other sites

yeah how?

 

Like this?

<?
          $db = new DbConnector();
	  $db->connect();
	  
	  $sql = "SELECT * FROM travek_logg GROUP BY time ORDER BY time DESC";
	  $result = $db->query($sql);
	  
	  $day = "yes";
	  while($fetch = mysql_fetch_array($result)) {
	  if($day != "no" && $day2 != date("l", $fetch['time'])) echo date("l", $fetch['time']);
	      echo "<br>".$fetch['nick'];
		  
		 $day = "no";
		 $day2 = date("l", $fetch['time']);
	  }
	  
	  ?>

Link to comment
https://forums.phpfreaks.com/topic/107230-split-into-day/#findComment-550206
Share on other sites

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.