Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //mysql connection
- mysql_connect('localhost', 'root', '') OR DIE ("Unable to connect to database! Please try again later.");
- //selecting the table
- mysql_select_db('local');
- //query
- $query = mysql_query("SELECT * FROM events3 WHERE date_end >= CURDATE() ORDER BY date_start LIMIT 5;");
- //http://stackoverflow.com/questions/2597098/get-the-last-n-rows-in-the-database-in-order
- //SELECT * FROM events ORDER BY date_start DESC LIMIT 5 ::Works but still need to reverse order
- //SELECT * FROM events ORDER BY id DESC LIMIT 5;
- //SELECT * FROM events ORDER BY id DESC LIMIT 5;
- //WHERE year = '2012'
- //fetch results
- WHILE($rows= mysql_fetch_array($query)):
- $id = $rows['id'];
- $title = $rows['title'];
- $date_start = $rows['date_start'];
- $date_end = $rows['date_end'];
- $time_start = $rows['time_start'];
- $time_end = $rows['time_end'];
- $location = $rows['location'];
- $description = $rows['description'];
- $image = $rows['image'];
- $hyperlink = $rows['hyperlink'];
- ?>
- <html>
- <style>
- html{
- font-family: arial;
- }
- </style>
- <?php
- echo "<b>ID:</b> "; echo "$id<br>";
- echo "<b>Title:</b> "; echo "$title<br>";
- echo "<b>Date Start:</b> ";
- echo "$date_start"; echo ' - '; echo "$date_end<br>";
- echo "<b>Time Frame:</b> ";
- echo "$time_start"; echo " - "; echo "$time_end<br>";
- echo "<b>Location:</b> "; echo "$location<br>";
- echo "<b>Description:</b> "; echo "$description<br><br><br>";
- if ($date_start == $date_end) {
- echo '$date_start';
- }else{
- }
- endwhile;
- // SELECT * FROM events ORDER BY id DESC LIMIT 10;
- ?>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement