marconi Posted May 5, 2009 Share Posted May 5, 2009 I am building a musician's website on a server running PHP4 alongside MySQL 5. One of the website features is an open source calendar that will be used to post performance dates. The calendar has already been set up and I have pieced together a bit of PHP code (see code below as well as attached image showing database structure with some dummy data) in order to pull upcoming performance information from the calendar database and post it to the website home page. All of this is already in place, but I now need to make the following two refinements to the output, and I'm not quite sure how to go about it (needless to say, I'm very new to PHP programming). Refinement 1: I want to limit the output on the homepage so that it never shows more than the next two upcoming shows. Refinement 2: The date and time for each show is currently formatted as follows: 5/1/2009 @ 04:00:00. I would like to change this to: May 1, 2009 @ 4:00pm. I suspect that the changes I need are not that difficult to come by. It is just (again) that I am very new to all of this. Any help here would be very much appreciated. Thanks in advance. -------------------------------------------------------------- My Code So Far (minus, of course, the actual connect details). <?php // Make an MySQL Connection mysql_connect("server", "username", "password") or die(mysql_error()); mysql_select_db("database name") or die(mysql_error()); // Get all the data from the "example" table $result = mysql_query("SELECT * FROM pec_mssgs") or die(mysql_error()); echo "<table border='0'>"; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of the specified rows into a table echo "<tr><td>"; echo"<h4>"; echo $row['m']. "/". $row['d']. "/". $row['y']. " @ " .$row['start_time']; echo"</h4>"; echo "</td></tr>"; echo "<tr><td>"; echo $row['title']; echo "<tr><td> </td></tr>"; //This places a blank row between events. echo "</td></tr>"; } echo "</table>"; ?> ------------------------------------------------------- [/img] [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.