I may have put this in the wrong section the first time. My apologies for double posting. This is a very simple thing I know, I'm just stupid and can't figure it out. Please help me.
I'm trying to pull info from a single database. The info consists of 3 things:
-Show Category (guestShow)
-Date (guestAir)
-Artist to appear (guestArtist)
I want the results to look like this:
Comedy
12/16 Tom Smith
12/17 John Jones
Action
12/12 Todd Taylor
12/17 Derik Donk
Drama
12/10 Sam Simpleton
12/11 Eric Irons
Anyone have a clue? Here is some of my code I've been trying to get to work, but it just stinks:
$location = "localhost";
$username = "";
$password = "";
$database = "";
$conn = mysql_connect("$location","$username","$password");
if (!$conn) die ("Could not connect MySQL");
mysql_select_db($database,$conn) or die ("Could not open database");
return($conn);
$taco = "guestShow";
$limit = getDate();
foreach($taco as $key => $value) {
$sql = "SELECT * FROM guest WHERE guestShow";
$sql = $sql." AND guestShow = \"$key\"";
$sql = $sql." LIMIT \"$limit\"";
$result=mysql_query($sql) or die("eat me");
if (mysql_num_rows($result) !=0) {
print "Category: $value";
while ($line = mysql_fetch_array($result,MYSQL_ASSOC)) {
$air = $line["guestAir"];
$artist = $line["guestArtist"];
print "$air<br>$artist<br><br>";
}
print "<br>";
}
}