Click to See Complete Forum and Search --> : New Problem simply display a list of results


Markbad311
01-30-2006, 03:05 PM
Getting a completly blank page on this one too. I am just displaying entries out of my table the field list is in the while loop.



<?php
ini_set("display_errors", "1");
error_reporting(E_ALL);
$page_title = "Battle of the Bands";
require("../listingsfunc.php");
dbconnect();
pagecount($page_title);
$table_name = "battle_bands_2006";
$sql = "SELECT *
FROM $table_name
WHERE 1
LIMIT 0 , 30";
$result = mysql_query($sql, $connection) or die (mysql_error());
$rock_block = "<table class=\"gbook\" width=\"70%\" align=\"center\">";
//While loop will create an array called $row
while ($row = mysql_fetch_array($result)) {
// get individual elements from the array
$id = ($row['id'])
$date = ($row['date']);
$band_name = ($row['band_name']);
$time = ($row['time']);
$genre = ($row['genre']);
$web_site = ($row['web_site']);
$e_mail = ($row['e_mail']);
$rock_block .= "
<tr class=\"gb_bar\">
<td colspan=\"2\"><span class=\"title_bar\">$band_name <br/>Date of Show: $date</span></td>
</tr>
<tr>
<td colspan=\"2\" class=\"msgblock\">Time on Stage: $time</td>
</tr>
<tr>
<td colspan=\"2\" class=\"msgblock\">Genre: $genre</td>
</tr>
<tr>
<td colspan=\"2\" class=\"msgblock\">Band E-Mail: $e_mail</td>
</tr>
";
if ($website != "") {
$rock_block .= "
<tr>
<td colspan=\"2\" class=\"msgbottom\"><span class=\"web\"><a href=\"$web_site\" title=\"Battle of the Bands\" target=\"_blank\">Band's Site</a> </span></td>
</tr>
";
} else {
$rock_block .= "
<tr>
<td colspan=\"2\" class=\"msgbottom\"><span class=\"web\">Sorry this band has no Web Site</span></td>
</tr>";
}
}
$rock_block .= "</table>";
mysql_close($connection);
?>

this just creates a table and one of the <TR> can be ommited if there is no result for $web_site Like I said I don't even get an error messgae with this one. Thanks!

Markbad311
01-30-2006, 03:08 PM
Sorry first issue now resolved! it was the missing semi-colon on the id = ($row['id]) Thank you View Page (http://www.eriescene.com/battle_bands_sherlocks/battle_of_the_bands.php)

Also I need to be able to Sort it two ways by date and by time.

There is three events on each day and they take place at 10p 11p and 12p I need to be able to sort these showing earliest to latest dates first then sort again from earliest time to latest time the show takes place.

SQL statement

$sql = "SELECT *
FROM `battle_bands_2006`
ORDER BY date AND time";

chazzy
01-30-2006, 06:15 PM
ORDER BY date,time

But why not just use a date/time field to store it, instead of separating them?

Markbad311
01-30-2006, 06:57 PM
got it all figured out. I keep the dates seperate because I like to pull from every table in the DB to show a massive events and information tables... Aside fromt hat it is just the specific Time they will be performing on that date. I just wanted an integer like 10 or 11 Chazzy please help me on my guest book man I am stumped! http://www.webdeveloper.com/forum/showthread.php?t=93405

For all who want to check out what we have been working on Battle of the Bands 2006 (http://www.eriescene.com/battle_bands_sherlocks/battle_of_the_bands.php)