Jump to content

wrong date time?


dadamssg

Recommended Posts

so wierd, i tried changing curdate() to curdatetime() but i guess that doesn't exist so i changed it back and no im getting errors when im formatting the $startt and $endt variables, but they were working fine before. any suggestions? oh and im getting an error with the session start() too, which i didn't get before

 

<?php
/* program: showevents.php*/

?>

<html>
<body>
<?php
   session_start();
   include("caneck.inc");
   
   $cxn = mysqli_connect($host,$user,$passwd,$dbname)
          or die ("Couldn't connect");
    
/*select todays events*/

$quer = "SELECT * FROM test WHERE DATE(start) <= CURDATE() AND DATE(end) >= CURDATE() ORDER BY start DESC";			
$result = mysqli_query($cxn,$quer)
          or die ("Couldn't execute");
		  
while($row = mysqli_fetch_assoc($result))
   {    
    /*Format dates to display*/

     $startt = DATE_FORMAT($row['start'], '%b %e %Y %l %i %p');
 $endt = DATE_FORMAT($row['end'], '%b %e %Y %l %i %p');

echo " <table border='3'>";
echo " <tr>"; 
echo "<td>{$row['eventid']}</td>";
echo "<td>{$row['created']}</td>";
echo "<td>{$row['title']}</td>";
echo "<td>{$row['event']}</td>";
echo "<td>{$row['description']}</td>";
echo "<td>{$row['location']}</td>";
echo "<td>/$$startt</td>";
echo "<td>/$$endt</td>";
echo "</tr></table>";
   }
?>
</body></html>

Link to comment
Share on other sites

change your query, let the database do it...

 

//
//
//
//

$quer = "SELECT eventid, created, title, event, description, location, DATE_FORMAT(start, '%b %e %Y %l %i %p') AS start, DATE_FORMAT(end, '%b %e %Y %l %i %p') AS end FROM test WHERE DATE(start) <= CURDATE() AND DATE(end) >= CURDATE() ORDER BY start DESC";

//
//
//
//

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.