Avatar billede stagedk Nybegynder
04. april 2009 - 07:37 Der er 8 kommentarer og
1 løsning

Skema m/mysql

Hej eksperter. den her virker utroligt svær for mig. (ved ikke om den er det)

Jeg skal lave et "skemasystem" til en webradio.
skemaet har jeg lavet osv med mysql og hvornår de spiller osv.
men! mit problem er.
som i kan se på http://hardgeneration.dk/index.php?page=schedule&day=Sat

skal jeg ha gjort sådan at hvis klokken er mellem 00:00 og 06:00
så skal Hardgeneration Hard Night være highlightet (orange). problemet er bare, at det vil være flextider (altså ikke umiddelbart fra 00:00 til 06:00. men at der måske kommer en ny tid som hedder fra 14:00 til fx 16:00. så skal den jo være highlightet. håber i forstår hvad jeg mener :)
på forhånd tak
Avatar billede nicklasb Nybegynder
04. april 2009 - 11:58 #1
Kan du vise os den kode, der udskriver listen fra MySQL databasen?
Avatar billede stagedk Nybegynder
04. april 2009 - 20:21 #2
hele schedule ser således ud:
skal lige sige det ikke er mig der har lavet alt det der html fis.
<?
include("includes/left_colum.php"); // default left colum

echo "<div id=\"colTwo\">";
echo "<h3>Schedule</h3>";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo "  <tr>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\">Mon</td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\">Tue</td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\">Wed</td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\">Thu</td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\">Fri</td>\n";
echo "    <td align=\"center\" style=\"background-color:#6E6E6E\">Sat</td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\">Sun</td>\n";
echo "  </tr>\n";
echo "  <tr>\n";
echo "    <td colspan=\"7\">\n";
echo "    <ul class=\"schedule\">\n";
echo "        <li> 00:00<br>\n";
echo "          Hardgeneration Hard Night</li>\n";
echo "        <li> 06:00<br>\n";
echo "          Hardgeneration Hard Morning</li>\n";
echo "        <li id=\"current\"> 13:00<br>\n";
echo "          Hardgeneration Hard Afternoon</li>\n";
echo "        <li> 18:00<br>\n";
echo "          DJ Kimse</li>\n";
echo "        <li> 19:00<br>\n";
echo "          DJ Stage</li>\n";
echo "        <li> 21:00<br>\n";
echo "          DJ Who ever</li>\n";
echo "      </ul>\n";
echo "    </td>\n";
echo "  </tr>\n";
echo "</table>\n";
echo "</div>";
?>
id=\"current\">$row[schedule_time]<br>\n";
echo "          $row[schedule_show]</li>\n";
}
}
$query = mysql_query("SELECT * FROM schedule WHERE schedule_day = 'Mon'");
while($row = mysql_fetch_assoc($query))
{
$g = "$row[schedule_time]";
$trans = array('$g');
$mode1 = current($trans);
$mode2 = next($trans);
echo "nu: $mode1 - næste: $mode2";
echo "        <li> $row[schedule_time]<br>\n";
echo "          $row[schedule_show]</li>\n";
}
echo "      </ul>\n";
echo "    </td>\n";
echo "  </tr>\n";
echo "</table>\n";
echo "</div>";
}
elseif(isset($_GET['day']) && $_GET['day'] == "Tue")
{
echo "<div id=\"colTwo\">";
echo "<h3>Schedule</h3>";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo "  <tr>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Mon'>Mon</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#6E6E6E\"><a href='index.php?page=schedule&day=Tue'>Tue</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Wed'>Wed</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Thu'>Thu</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Fri'>Fri</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Sat'>Sat</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Sun'>Sun</a></td>\n";
echo "  </tr>\n";
echo "  <tr>\n";
echo "    <td colspan=\"7\">\n";
echo "    <ul class=\"schedule\">\n";
echo "        <li> 00:00<br>\n";
echo "          Hardgeneration Hard Night</li>\n";
echo "        <li> 06:00<br>\n";
echo "          Hardgeneration Hard Morning</li>\n";
echo "        <li id=\"current\"> 13:00<br>\n";
echo "          Hardgeneration Hard Afternoon</li>\n";
echo "        <li> 18:00<br>\n";
echo "          DJ Kimse</li>\n";
echo "        <li> 19:00<br>\n";
echo "          DJ Stage</li>\n";
echo "        <li> 21:00<br>\n";
echo "          DJ Who ever</li>\n";
echo "      </ul>\n";
echo "    </td>\n";
echo "  </tr>\n";
echo "</table>\n";
echo "</div>";
}
elseif(isset($_GET['day']) && $_GET['day'] == "Wed")
{
echo "<div id=\"colTwo\">";
echo "<h3>Schedule</h3>";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo "  <tr>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Mon'>Mon</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Tue'>Tue</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#6E6E6E\"><a href='index.php?page=schedule&day=Wed'>Wed</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Thu'>Thu</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Fri'>Fri</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Sat'>Sat</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Sun'>Sun</a></td>\n";
echo "  </tr>\n";
echo "  <tr>\n";
echo "    <td colspan=\"7\">\n";
echo "    <ul class=\"schedule\">\n";
echo "        <li> 00:00<br>\n";
echo "          Hardgeneration Hard Night</li>\n";
echo "        <li> 06:00<br>\n";
echo "          Hardgeneration Hard Morning</li>\n";
echo "        <li id=\"current\"> 13:00<br>\n";
echo "          Hardgeneration Hard Afternoon</li>\n";
echo "        <li> 18:00<br>\n";
echo "          DJ Kimse</li>\n";
echo "        <li> 19:00<br>\n";
echo "          DJ Stage</li>\n";
echo "        <li> 21:00<br>\n";
echo "          DJ Who ever</li>\n";
echo "      </ul>\n";
echo "    </td>\n";
echo "  </tr>\n";
echo "</table>\n";
echo "</div>";
}
elseif(isset($_GET['day']) && $_GET['day'] == "Thu")
{
echo "<div id=\"colTwo\">";
echo "<h3>Schedule</h3>";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo "  <tr>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Mon'>Mon</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Tue'>Tue</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Wed'>Wed</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#6E6E6E\"><a href='index.php?page=schedule&day=Thu'>Thu</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Fri'>Fri</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Sat'>Sat</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Sun'>Sun</a></td>\n";
echo "  </tr>\n";
echo "  <tr>\n";
echo "    <td colspan=\"7\">\n";
echo "    <ul class=\"schedule\">\n";
echo "        <li> 00:00<br>\n";
echo "          Hardgeneration Hard Night</li>\n";
echo "        <li> 06:00<br>\n";
echo "          Hardgeneration Hard Morning</li>\n";
echo "        <li id=\"current\"> 13:00<br>\n";
echo "          Hardgeneration Hard Afternoon</li>\n";
echo "        <li> 18:00<br>\n";
echo "          DJ Kimse</li>\n";
echo "        <li> 19:00<br>\n";
echo "          DJ Stage</li>\n";
echo "        <li> 21:00<br>\n";
echo "          DJ Who ever</li>\n";
echo "      </ul>\n";
echo "    </td>\n";
echo "  </tr>\n";
echo "</table>\n";
echo "</div>";
}
elseif(isset($_GET['day']) && $_GET['day'] == "Fri")
{
echo "<div id=\"colTwo\">";
echo "<h3>Schedule</h3>";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo "  <tr>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Mon'>Mon</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Tue'>Tue</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Wed'>Wed</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Thu'>Thu</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#6E6E6E\"><a href='index.php?page=schedule&day=Fri'>Fri</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Sat'>Sat</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Sun'>Sun</a></td>\n";
echo "  </tr>\n";
echo "  <tr>\n";
echo "    <td colspan=\"7\">\n";
echo "    <ul class=\"schedule\">\n";
echo "        <li> 00:00<br>\n";
echo "          Hardgeneration Hard Night</li>\n";
echo "        <li> 06:00<br>\n";
echo "          Hardgeneration Hard Morning</li>\n";
echo "        <li id=\"current\"> 13:00<br>\n";
echo "          Hardgeneration Hard Afternoon</li>\n";
echo "        <li> 18:00<br>\n";
echo "          DJ Kimse</li>\n";
echo "        <li> 19:00<br>\n";
echo "          DJ Stage</li>\n";
echo "        <li> 21:00<br>\n";
echo "          DJ Who ever</li>\n";
echo "      </ul>\n";
echo "    </td>\n";
echo "  </tr>\n";
echo "</table>\n";
echo "</div>";
}
elseif(isset($_GET['day']) && $_GET['day'] == "Sat")
{
echo "<div id=\"colTwo\">";
echo "<h3>Schedule</h3>";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo "  <tr>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Mon'>Mon</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Tue'>Tue</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Wed'>Wed</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Thu'>Thu</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Fri'>Fri</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#6E6E6E\"><a href='index.php?page=schedule&day=Sat'>Sat</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Sun'>Sun</a></td>\n";
echo "  </tr>\n";
echo "  <tr>\n";
echo "    <td colspan=\"7\">\n";
echo "    <ul class=\"schedule\">\n";
echo "        <li> 00:00<br>\n";
echo "          Hardgeneration Hard Night</li>\n";
echo "        <li> 06:00<br>\n";
echo "          Hardgeneration Hard Morning</li>\n";
echo "        <li id=\"current\"> 13:00<br>\n";
echo "          Hardgeneration Hard Afternoon</li>\n";
echo "        <li> 18:00<br>\n";
echo "          DJ Kimse</li>\n";
echo "        <li> 19:00<br>\n";
echo "          DJ Stage</li>\n";
echo "        <li> 21:00<br>\n";
echo "          DJ Who ever</li>\n";
echo "      </ul>\n";
echo "    </td>\n";
echo "  </tr>\n";
echo "</table>\n";
echo "</div>";
}
elseif(isset($_GET['day']) && $_GET['day'] == "Sun")
{
echo "<div id=\"colTwo\">";
echo "<h3>Schedule</h3>";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo "  <tr>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Mon'>Mon</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Tue'>Tue</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Wed'>Wed</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Thu'>Thu</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Fri'>Fri</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\"><a href='index.php?page=schedule&day=Sat'>Sat</a></td>\n";
echo "    <td align=\"center\" style=\"background-color:#6E6E6E\"><a href='index.php?page=schedule&day=Sun'>Sun</a></td>\n";
echo "  </tr>\n";
echo "  <tr>\n";
echo "    <td colspan=\"7\">\n";
echo "    <ul class=\"schedule\">\n";
echo "        <li> 00:00<br>\n";
echo "          Hardgeneration Hard Night</li>\n";
echo "        <li> 06:00<br>\n";
echo "          Hardgeneration Hard Morning</li>\n";
echo "        <li id=\"current\"> 13:00<br>\n";
echo "          Hardgeneration Hard Afternoon</li>\n";
echo "        <li> 18:00<br>\n";
echo "          DJ Kimse</li>\n";
echo "        <li> 19:00<br>\n";
echo "          DJ Stage</li>\n";
echo "        <li> 21:00<br>\n";
echo "          DJ Who ever</li>\n";
echo "      </ul>\n";
echo "    </td>\n";
echo "  </tr>\n";
echo "</table>\n";
echo "</div>";
}
else
{
$dato = date("D");
header("Location: index.php?page=schedule&day=$dato");
}
?>
Avatar billede kjeldsted Novice
05. april 2009 - 11:34 #3
En god start ville nu nok være at få lidt bedre overblik over koden. Jeg ville nok anbefale dig at undlade skrivemåden:

echo "<div id=\"colTwo\">";
echo "<h3>Schedule</h3>";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo "  <tr>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\">Mon</td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\">Tue</td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\">Wed</td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\">Thu</td>\n";
echo "    <td align=\"center\" style=\"background-color:#5C5C5C\">Fri</td>\n";

men i stedet skrive:

echo "<div id="colTwo">
<h3>Schedule</h3>
<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n
  <tr>\n
    <td align=\"center\" style=\"background-color:#5C5C5C\">Mon</td>\n
    <td align=\"center\" style=\"background-color:#5C5C5C\">Tue</td>\n
    <td align=\"center\" style=\"background-color:#5C5C5C\">Wed</td>\n
    <td align=\"center\" style=\"background-color:#5C5C5C\">Thu</td>\n
    <td align=\"center\" style=\"background-color:#5C5C5C\">Fri</td>\n";

Bare et lille godt råd ;)
Avatar billede kjeldsted Novice
05. april 2009 - 11:39 #4
Og mht. dit spørgsmål er jeg vist ikke helt med på hvad du mener.
Avatar billede stagedk Nybegynder
05. april 2009 - 13:12 #5
Igen kjeldsted, det er ikke mig der har lavet alt htmlen :), men ja, jeg siger det til ham..
altså jeg skal jo have den til at gå ind i databasen og se, altså  $row[show] / $row[tid] . så skal den ind og hente næste tidspunkt i db'en og derved markere den tid/dj der spiller i tidsrummet :)
Avatar billede andreas13_fam Nybegynder
05. april 2009 - 13:16 #6
ja jeg kan da se en fejl: ved at lukke php udføres resten ikke.
?>
id=\"current\">$row[schedule_time]<br>\n";
echo "          $row[schedule_show]</li>\n";
}


Desuden tager det altså ikke lang tid at fjerne det htmlfis:
<?
include("includes/left_colum.php"); // default left colum
echo '
<div id="colTwo">
<h3>Schedule</h3>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" style="background-color:#5C5C5C">Mon</td>
    <td align="center" style="background-color:#5C5C5C">Tue</td>
    <td align="center" style="background-color:#5C5C5C">Wed</td>
    <td align="center" style="background-color:#5C5C5C">Thu</td>
    <td align="center" style="background-color:#5C5C5C">Fri</td>
    <td align="center" style="background-color:#6E6E6E">Sat</td>
    <td align="center" style="background-color:#5C5C5C">Sun</td>
  </tr>
  <tr>
    <td colspan="7">
    <ul class="schedule">
        <li> 00:00<br>
          Hardgeneration Hard Night</li>
        <li> 06:00<br>
          Hardgeneration Hard Morning</li>
        <li id="current"> 13:00<br>
          Hardgeneration Hard Afternoon</li>
        <li> 18:00<br>
          DJ Kimse</li>
        <li> 19:00<br>
          DJ Stage</li>
        <li> 21:00<br>
          DJ Who ever</li>
      </ul>
    </td>
  </tr>
</table>
</div>
    ';
/*_________________________
dette giver ikke mening for mange
?>

    id="current">'.$row[schedule_time].'<br>
          $'.row[schedule_show].'</li>

}
}
____________________________*/
$query = mysql_query("SELECT * FROM schedule WHERE schedule_day = 'Mon'");
while($row = mysql_fetch_assoc($query))
{
$g = $row[schedule_time];
$trans = array($g);
$mode1 = current($trans);
$mode2 = next($trans);
echo '
nu: '.$mode1.' - næste: '.$mode2.'
        <li> $row[schedule_time]<br>
          $row[schedule_show]</li>
    ';
}
echo '
      </ul>
    </td>
  </tr>
</table>
</div>
    ';
}
elseif(isset($_GET['day']) && $_GET['day'] == "Tue")
{
echo '
<div id="colTwo">
<h3>Schedule</h3>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Mon">Mon</a></td>
    <td align="center" style="background-color:#6E6E6E"><a href="index.php?page=schedule&day=Tue">Tue</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Wed">Wed</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Thu">Thu</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Fri">Fri</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Sat">Sat</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Sun">Sun</a></td>
  </tr>
  <tr>
    <td colspan="7">
    <ul class="schedule">
        <li> 00:00<br>
          Hardgeneration Hard Night</li>
        <li> 06:00<br>
          Hardgeneration Hard Morning</li>
        <li id="current"> 13:00<br>
          Hardgeneration Hard Afternoon</li>
        <li> 18:00<br>
          DJ Kimse</li>
        <li> 19:00<br>
          DJ Stage</li>
        <li> 21:00<br>
          DJ Who ever</li>
      </ul>
    </td>
  </tr>
</table>
</div>
    ';
}
elseif(isset($_GET['day']) && $_GET['day'] == "Wed")
{
echo '
<div id="colTwo">
<h3>Schedule</h3>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Mon">Mon</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Tue">Tue</a></td>
    <td align="center" style="background-color:#6E6E6E"><a href="index.php?page=schedule&day=Wed">Wed</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Thu">Thu</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Fri">Fri</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Sat">Sat</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Sun">Sun</a></td>
  </tr>
  <tr>
    <td colspan="7">
    <ul class="schedule">
        <li> 00:00<br>
          Hardgeneration Hard Night</li>
        <li> 06:00<br>
          Hardgeneration Hard Morning</li>
        <li id="current"> 13:00<br>
          Hardgeneration Hard Afternoon</li>
        <li> 18:00<br>
          DJ Kimse</li>
        <li> 19:00<br>
          DJ Stage</li>
        <li> 21:00<br>
          DJ Who ever</li>
      </ul>
    </td>
  </tr>
</table>
</div>
    ';
}
elseif(isset($_GET['day']) && $_GET['day'] == "Thu")
{
echo '
<div id="colTwo">
<h3>Schedule</h3>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Mon">Mon</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Tue">Tue</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Wed">Wed</a></td>
    <td align="center" style="background-color:#6E6E6E"><a href="index.php?page=schedule&day=Thu">Thu</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Fri">Fri</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Sat">Sat</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Sun">Sun</a></td>
  </tr>
  <tr>
    <td colspan="7">
    <ul class="schedule">
        <li> 00:00<br>
          Hardgeneration Hard Night</li>
        <li> 06:00<br>
          Hardgeneration Hard Morning</li>
        <li id="current"> 13:00<br>
          Hardgeneration Hard Afternoon</li>
        <li> 18:00<br>
          DJ Kimse</li>
        <li> 19:00<br>
          DJ Stage</li>
        <li> 21:00<br>
          DJ Who ever</li>
      </ul>
    </td>
  </tr>
</table>
</div>
    ';
}
elseif(isset($_GET['day']) && $_GET['day'] == "Fri")
{
echo '
<div id="colTwo">
<h3>Schedule</h3>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Mon">Mon</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Tue">Tue</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Wed">Wed</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Thu">Thu</a></td>
    <td align="center" style="background-color:#6E6E6E"><a href="index.php?page=schedule&day=Fri">Fri</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Sat">Sat</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Sun">Sun</a></td>
  </tr>
  <tr>
    <td colspan="7">
    <ul class="schedule">
        <li> 00:00<br>
          Hardgeneration Hard Night</li>
        <li> 06:00<br>
          Hardgeneration Hard Morning</li>
        <li id="current"> 13:00<br>
          Hardgeneration Hard Afternoon</li>
        <li> 18:00<br>
          DJ Kimse</li>
        <li> 19:00<br>
          DJ Stage</li>
        <li> 21:00<br>
          DJ Who ever</li>
      </ul>
    </td>
  </tr>
</table>
</div>
    ';
}
elseif(isset($_GET['day']) && $_GET['day'] == "Sat")
{
echo '
<div id="colTwo">
<h3>Schedule</h3>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Mon">Mon</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Tue">Tue</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Wed">Wed</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Thu">Thu</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Fri">Fri</a></td>
    <td align="center" style="background-color:#6E6E6E"><a href="index.php?page=schedule&day=Sat">Sat</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Sun">Sun</a></td>
  </tr>
  <tr>
    <td colspan="7">
    <ul class="schedule">
        <li> 00:00<br>
          Hardgeneration Hard Night</li>
        <li> 06:00<br>
          Hardgeneration Hard Morning</li>
        <li id="current"> 13:00<br>
          Hardgeneration Hard Afternoon</li>
        <li> 18:00<br>
          DJ Kimse</li>
        <li> 19:00<br>
          DJ Stage</li>
        <li> 21:00<br>
          DJ Who ever</li>
      </ul>
    </td>
  </tr>
</table>
</div>
    ';
}
elseif(isset($_GET['day']) && $_GET['day'] == "Sun")
{
echo '
<div id="colTwo">
<h3>Schedule</h3>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Mon2>Mon</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Tue">Tue</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Wed">Wed</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Thu">Thu</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Fri">Fri</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Sat">Sat</a></td>
    <td align="center" style="background-color:#6E6E6E"><a href="index.php?page=schedule&day=Sun">Sun</a></td>
  </tr>
  <tr>
    <td colspan="7">
    <ul class="schedule">
        <li> 00:00<br>
          Hardgeneration Hard Night</li>
        <li> 06:00<br>
          Hardgeneration Hard Morning</li>
        <li id="current"> 13:00<br>
          Hardgeneration Hard Afternoon</li>
        <li> 18:00<br>
          DJ Kimse</li>
        <li> 19:00<br>
          DJ Stage</li>
        <li> 21:00<br>
          DJ Who ever</li>
      </ul>
    </td>
  </tr>
</table>
</div>
    ';
}
else
{
$dato = date("D");
header("Location: index.php?page=schedule&day=".$dato);
}
?>
Avatar billede nizo Nybegynder
05. april 2009 - 14:52 #7
Hvad er problemet i at skrive;

elseif(isset($_GET['day']) && $_GET['day'] == "Fri")
{
?>
<div id="colTwo">
<h3>Schedule</h3>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Mon">Mon</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Tue">Tue</a></td>
    <td align="center" style="background-color:#5C5C5C"><a href="index.php?page=schedule&day=Wed">Wed</a></td>

....
<?php
}
?>

PHP er så smart indrettet at tags kan startes og sluttes som det passer én, uden det har konsekvenser for udførsel af phpkoden. Dvs. du kan sagtens afslutte php tags selvom du har en if-clause eller en anden form for condition miljø kørende, uden at bryde noget. Forskellen er bare du nemmere har adgang til html'en, men skal bruge små echoes i html'en, hvor der skal være dynamisk indhold.
Avatar billede andreas13_fam Nybegynder
05. april 2009 - 15:29 #8
ja det kan man også bare gøre.
Avatar billede stagedk Nybegynder
06. april 2009 - 23:08 #9
tror bare jeg lukker :). det her fører ingen vegne.
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester



Seneste spørgsmål Seneste aktivitet
I dag 06:10 Excel åbner fil i kæmpe format Af Aske i Excel
I går 22:00 Datafordeler Af Lsk i PHP
I går 12:37 Summere beløb pr. dato Af TTA i Excel
31/1022:44 Tilslutte chassic fans Af viking69 i PC
31/1020:28 LED lysstofrør Af ErikHg i Fri debat