Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Cool question and this sort of thing is exactly what PHP was built for - dynamically displaying HTML to the browser based on certain criteria.</p> <p>So it sounds like you have the database INSERT and UPDATE portions settled. I do recommend that you use timestamps rather than dates. It also makes it easier to handle queries in MySQL for finding specific dates since timestamps are integers and can be sorted as such. To get a timestamp you can use the time() expression in PHP to get the current time or you can use strtotime the timestamp for a specific date. For example:</p> <pre><code>$newDate = strtotime("March 3, 2014"); //$newDate is now a timestamp for that date rather than plain text </code></pre> <p>strtotime is flexible and can handle other date types, including numbers with dashes like 12/14/2013.</p> <p>But anyway, once you have that settled, you need to work on your SELECT queries for the front-end display.</p> <p>It'll look something like this:</p> <pre><code>$now = time(); $html = ''; $pull = mysql_query("SELECT imageurl,width,height,time FROM banners WHERE bannerstart &lt;= '$now' AND bannerend &lt;= '$now'"); while($row = mysql_fetch_array($pull)){ $html .= "&lt;img src='" . $row['imageurl'] . "' /&gt;"; //build the rest of your HTML here too and echo it to the page below } if($html == ''){ echo "No images right now. Please check back later!"; }else{ echo $html; } </code></pre> <p>If you're looking into banners that fade from one to the next like you see in large multi-media displays, I recommend <a href="http://jquery.malsup.com/cycle2/" rel="nofollow">Cycle2</a>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload