Hello again,
I'm back with yet another question.
I have a search page with the following code.
<form action="<?php echo $PHP_SELF ?>" method="post">
Type in your search criteria and select if it's an artist or an album:<br>
<P><input type=text name="query" value="">
<input type="submit" name="search" value="Go"><br>
<P><input type="radio" name="radio" value="artist" checked>Artist:  
<input type="radio" name="radio" value="album">Album:
<p>Or <input type="submit" name="search" value="View All">
<p>Or <input type="submit" name="search" value="All_Bands">
</form>
<?php
if($search == "Go")
{
if($query !="")
{
if($radio == "artist")
{
$db->search_artist($query);
}
else if($radio == "album")
{
//search for album, list tracks
$db->search_album($query);
}
}
else
{
print("You did not enter a search criteria, please try again...");
}
}
if($search == "View All")
{
//list all artists and albums
}
if($search == "All_Bands")
{
$db->search_all_artists();
}
?>
Based on the function I call, it produces the result at different positions on the screen. If I search_all_artists then the list is produced way at the bottom. Each function produces a table and pumps out the results of the query but why are they all positioned differently. If you wanna see what I mean go to skit.myip.org/cd/search.php and serach for "the strokes" and then try the all bands button, those results are posted way at the bottom.
Ps here are my function defs.
function search_artist($band)
{
$query = "Select * from album where band_name = '$band';";
if(!($result = mysql_query($query,$this->dblink)))
{
print("<br>");
printf("%s was not found", $band);
print("<br>");
}
else
{
printf("Results of search for %s:", $band);
print("<table><tr><td>Album</td></tr><br>\n");
while($row = mysql_fetch_row($result))
{
print("<tr><td>\n");
print($row[1]);
print("</td></tr><br>\n");
}
print("</table><br>");
}
}
function search_album($album)
{
$query = "select * from track where album_name = '$album';";
if(!($result = mysql_query($query,$this->dblink)))
{
print("<br>");
printf("%s was not found", $album);
print("<br>");
}
else
{
printf("Results of search for %s:", $album);
print("<table><tr><td>Tracks</td></tr><br>\n");
while($row = mysql_fetch_row($result))
{
print("<tr><td>\n");
print($row[2]);
print("</td></tr><br>\n");
}
print("</table><br>");
}
}
function search_all_artists()
{
$query = "select * from artist;";
if(!($result = mysql_query($query,$this->dblink)))
{
print("<br>");
printf("Query failed was not found");
print("<br>");
}
else
{
printf("Results of search for all artist in collection:<br>");
print("<table><tr><td>Artists</td></tr><br>\n");
while($row = mysql_fetch_row($result))
{
print("<tr><td>\n");
print($row[1]);
print("</td></tr><br>\n");
}
print("</table><br>");
}
}
Thanks
Dan