Hey guys. I implemented my first php script last night, and I have all but one thing working. I used this script:
Code:
http://www.hotscripts.com/Detailed/22477.html
And I implemented it here:
Code:
http://www.shakedownmusic.net/test6.php
I made several modifications to make the script fit into the layout I'm using for the website, but I can't figure out how to modify one thing... If you look at the "Upcoming Shows" area, you will see that the date prints as the number of the month with no leading zeros. I'd like that to print as the full textual version of the month (ie 1 should equal January and so on). I looked in some books and tried using if statements to say if the_month = 1 then the_full_month = January, but I don't know the correct syntax or if that's the best way to do it.
Any help you guys could give me would be greatly appreciated. Thanks for your time!
Marcus
Here is the script after my mods:
PHP Code:
<?php
// read in the connection settings
require("showlist/samples/showlister_settings.inc.php");
require("showlist/samples/showlister_methods.inc.php");
// connect to the RDBMS
$db = mysql_connect("$site","$user","$pass")
or die_now("<h2>Could not connect to database server</h2><p>Check passwords and sockets</p>");
// select the database
mysql_select_db("$database",$db)
or die_now("<h2>Could not select database $database</h2><p>Check database name</p>");
// select all the shows in the database
$result = mysql_query("select show_id, month, day, year, location, details, venue
from $database_table order by year, month, day",$db)
or die_now("<h2>Could not select shows</h2>");
// set up the table
echo("<div id='shows' style='position:absolute; left:6px; top:193px; width:265px; height:189px; z-index:6; overflow: auto;'>\n");
echo("<table width='239' border='0' cellspacing='0' cellpadding='0'>\n");
echo("\t<tr>\n\t\t<td colspan='3'><img src='images/blank_line.gif'></td>\n\t\t</tr>\n");
// print the next five shows
// thanks to Lee Mikles (lee@getcohesive.com) for contributing the
// first version of this code
$cur_month = date("n");
$cur_day = date("d");
$cur_year = date("Y");
$event_count=1;
// echo out the next five shows
while(($row = mysql_fetch_array($result)) and ($event_count <= 10)) {
$the_id = $row["show_id"];
$the_month = $row["month"];
$the_day = $row["day"];
$the_year = $row["year"];
$the_location = $row["location"];
$the_details = $row["details"];
$the_venue = $row["venue"];
__________________
Hermawan Haryanto
Senior Programmer - Red Rock Reef LLC
Las Vegas, Nevada 89123 USA
1.800.9.Subnet | Fax: 1.702.920.8277
http://www.redrockreef.com