Jump to content

bschultz

Members
  • Posts

    486
  • Joined

  • Last visited

Everything posted by bschultz

  1. <code> echo '<object type="application/x-shockwave-flash" data="/player/dewplayer.swf" width="200" height="30" id="dewplayer" name="dewplayer">'; echo '<param name="movie" value="/player/dewplayer.swf" />'; echo '<param name="flashvars" value="mp3=<?php echo $file; ?>" />'; echo '<param name="wmode" value="transparent" />'; echo '</object>'; </code>
  2. I need to pull a list of mp3 file names to create a playlist. I have a column for "priority" which will handle the rotation of the mp3's...so that a priority of 4 will play more often than a priority of 3...and so on. I have this code (which works) to select a column from the db that matches the selected criteria...AND has a priority of "4". If there are no matches, select a row that has a priority of "3". How can I clean up this code...preferably to remove the need for adding 2's after each variable? Also, is there a better way of handling this, so that it's ONE select...and then puts the mp3's in the playlist the correct number of times? <?php $sql = "SELECT * FROM audio WHERE `client_id` = '$client' AND (`start_date` <= '$nownohour' AND `end_date` >= '$nownohour') AND `$dow` = '1' AND `is_active` = '1' AND (`start_hour` <= '$hournozero' AND `end_hour` >= '$hournozero') AND `priority` = '4' LIMIT 1"; $rs = mysql_query($sql,$dbc); $matches = 0; while ($row = mysql_fetch_assoc($rs)) { $matches++; echo "$row[title].mp3<br />"; } if (!$matches) { $sql2 = "SELECT * FROM audio WHERE `client_id` = '$client' AND (`start_date` <= '$now' AND `end_date` >= '$now') AND `$dow` = '1' AND `is_active` = '1' AND (`start_hour` <= '$hournozero' AND `end_hour` >= '$hournozero') AND `priority` = '3' LIMIT 1"; $rs2 = mysql_query($sql2,$dbc); $matches2 = 0; while ($row2 = mysql_fetch_assoc($rs2)) { $matches2++; echo "$row2[title].mp3<br />"; } } echo "-------------<br />"; ?> Thanks!
  3. thanks much dcro2...worked great.
  4. I'm trying to get a php script working to download the latest CNN news podcast each hour. CNN names the file based on the year, month, day, and time. Here's what I'm trying: <?php $year = date('Y'); $month = date('m'); $day = date('d'); $now = date('Y-m-d-h'); $hour = date('gA'); $hourplus1 = ($hour + 1); $hourminus1 = ($hour - 1); $ampm = date('A'); $url = "http://podcasts.cnn.net/cnn/services/podcasting/newscast/" . "audio/" . "$year" . "/" . "$month" . "/" . "$day" . "/CNN-News-" . "$month" . "-" . "$day" . "-" . "$year" . "-" . "$hourplus1" . "$ampm" . ".mp3"; echo $url; echo system('wget "$url"'); ?> When running from the shell, I get an "http://: invalid hostname" error. The echo of $url looks right...but it won't run from shell. Any ideas?
  5. I'm the scheduler for a group of baseball umpires. We have 20 umpires and work over 200 games a year. I currently schedule through a VERY high tech way of picking names out of a hat. Once I schedule the games by hand, I then enter them into a database so that our umpires can see the schedule on our website. I'd like to automate this process. Here's what I'm thinking: Database structure - - - -1 table for list of umpires (includes columns for name, level of service (varsity, JV, junior high, etc.), how many games they can work (veteran umpires get more games than new umpires) and whether that umpire is an active member (can be scheduled) -1 table for the list of games (pretty self explanatory) -1 table for the umpire login info (used to log into the system) -1 table for the vacation days (individual umpires can log in and add days that they CAN NOT work) -1 table for schools that each umpire can't work (too far to travel, had issues with a coach, etc) I can handle all of this...EXCEPT the automatic scheduling of the games...and the following: I want to be able to schedule games individually, by week, month or by the season (flexible). I also need to be able to manually schedule games...and to automatically schedule games that are added at a later date (I've scheduled the season...but we add 20 more games later). I also need to ensure that any individual umpire doesn't work more than "x" number of games per team. That number "can" be exceeded if need be, but it won't unless it has to be. I also need to be able to notify umpires (by email) if I make a change to their schedule. I'll start with the automatically scheduling of games. I'm sure that there is a php class or function that will help with this...but I have no idea what that might be. Also, am I missing something in the db structure? Can you please pass along any ideas you may have that might help me? Thanks much!
  6. That did it...thank you!!!
  7. Thanks for the help. Unfortunately, it has the same results. In the "real" code I'm using, I have actual umpire names in the array...which I'd rather not post in a public forum....not Umpire name 1, umpire name 2 etc.
  8. those are both in config.php. It appears that it's a problem with the select. I can't even strip it down to one umpire (hardcoded) and one town (hardcoded) without getting the same result.
  9. I have a mysql database table that lists baseball and softball umpires for the season. The table has columns for: date, sport, umpire1, umpire2, umpire3, umpire 4, umpire5, visitor team, and home team. I'm trying to write a bit of code that will tell me how many times I have schedule (manually) an umpire to see a particular school. Here's what I've come up with. <?php require_once "/config.php"; $dbc = mysql_pconnect($host, $username, $password); mysql_select_db($db,$dbc); $start_date = '2011-04-01'; $end_date = '2011-06-01'; $umpires = Array('umpire 1 name', 'umpire 1 name', 'umpire 2 name', 'umpire 3 name', 'umpire 4 name', 'umpire 5 name', 'umpire 6 name'); $schools = Array('Bagley', 'Bemidji', 'Blackduck', 'Fosston', 'International Falls', 'Kelliher', 'Laporte', 'Lake of the Woods', 'Remer', 'Walker'); ?> <?php foreach($umpires as $umps) { //selects the first umpire in the array echo "<table width='20%' border ='1'>"; echo "<tr><td>$umps</td><td>Baseball</td><td>Softball</td></tr>"; foreach($schools as $town) { //selects the first town in the array $sql_baseball = "SELECT * FROM $table WHERE (ump1 = $umps OR ump2 = $umps OR ump3 = $umps OR ump4 = $umps OR ump5 = $umps) AND (visitor = $town OR home = $town) AND sport = 'Baseball' AND date >= $start_date AND DATE <= $end_date"; $result_baseball = mysql_query($sql_baseball); $count_baseball=mysql_num_rows($result_baseball); $sql_softball = "SELECT * FROM $table WHERE (ump1 = $umps OR ump2 = $umps OR ump3 = $umps OR ump4 = $umps OR ump5 = $umps) AND (visitor = $town OR home = $town) AND sport = 'Softball' AND date >= $start_date AND DATE <= $end_date"; $result_softball = mysql_query($sql_softball); $count_softball=mysql_num_rows($result_softball); echo "<td>$town</td><td>$count_baseball</td><td>$count_softball</td></tr>"; } //loops the towns echo "</table>"; } //ends each umpire ?> As you can see, I've put all the umpire names in an array...and each school in a separate array. The html tables are being displayed (with the correct names and schools listed...but I'm getting this error: Line 33 is this - - - $count_baseball=mysql_num_rows($result_baseball); Line 37 is this - - - $count_softball=mysql_num_rows($result_softball); I'm guessing that the problem is that I have multiple selects (one for each town) while using the same variable names for each select...but I can't figure out how to concacate the variable names properly...or even if that's the problem. Any ideas? Thanks!
  10. Once again...I try to make things too complicated! Thanks!
  11. I have two blogs (about the same topic) that I'd like to migrate into one blog. The one blog is a B2Evolution blog...while I wrote the other one. I have re-ordered the columns (names of...and placement of...)of the old B2evo blog to match the format of the one I wrote. I'm ready to import the data from the B2evo blog...but the column "row_number" is a primary key set to auto increment. The problem is that I already have data in the blog I wrote that will match the row_number of the B2evo blog. How can I merge the contents of these two with the most ease so as to avoid a conflict in the matching row_number's?
×
×
  • 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.