shortyb
07-26-2008, 06:53 AM
Ok currently this is what I use for each day of the week. Its queried by asc 'starttime'. It seems like I am repeating when I dont need to, I am real new to php and still learning the basics but kinda jump head first you know? I could really use the help on a better way to sort by 'day' of week and display each 'name' and info under that day.
echo "<p class='headline'>Sunday</p>";
$schedule = get_schedule();
while ($post = mysql_fetch_array($schedule)) {
if ($post["day"]=="Sunday")
echo "<div class='title'> {$post["starttime"]} - {$post["endtime"]} | <strong>{$post["name"]}</strong> </div>
<div class='tag'>with {$post["dj"]}: {$post["discription"]} </div>";
}
echo "<br /><p class='headline'>Monday</p>";
$schedule = get_schedule();
while ($post = mysql_fetch_array($schedule)) {
if ($post["day"]=="Monday")
echo "<div class='title'> {$post["starttime"]} - {$post["endtime"]} | <strong>{$post["name"]}</strong> </div>
<div class='tag'>with {$post["dj"]}: {$post["discription"]} </div>";
}
This code works fine but I can see it build the page as it pulls my function for each day seeing as it queries the mySQL each time get_schedule() is called I figured thats why I can see it build itself. This was kinda my first clue to I am doing something wrong.
echo "<p class='headline'>Sunday</p>";
$schedule = get_schedule();
while ($post = mysql_fetch_array($schedule)) {
if ($post["day"]=="Sunday")
echo "<div class='title'> {$post["starttime"]} - {$post["endtime"]} | <strong>{$post["name"]}</strong> </div>
<div class='tag'>with {$post["dj"]}: {$post["discription"]} </div>";
}
echo "<br /><p class='headline'>Monday</p>";
$schedule = get_schedule();
while ($post = mysql_fetch_array($schedule)) {
if ($post["day"]=="Monday")
echo "<div class='title'> {$post["starttime"]} - {$post["endtime"]} | <strong>{$post["name"]}</strong> </div>
<div class='tag'>with {$post["dj"]}: {$post["discription"]} </div>";
}
This code works fine but I can see it build the page as it pulls my function for each day seeing as it queries the mySQL each time get_schedule() is called I figured thats why I can see it build itself. This was kinda my first clue to I am doing something wrong.