Result Function
Posted: Fri Jan 16, 2004 3:55 pm
I have this function, but only the first result prints anything! Help!
Code: Select all
function pickmusic() {
global $cook, $dbname, $menupage, $dbname, $table, $menupage, $musicpage, $addmusicpage, $addmusicpageform, $cookiepage, $deletemusicpage, $deletemusicpageform, $loop, $autostart, $visible;
return "<center>Please select what song you would like to play.<form method="post" action="".$cookiepage.""><select name="dropdown"><option value="none" selected>None</option><option value="none">----------------</option>";
if ($db = sqlite_open($dbname, 0666, $sqliteerror)){ //Tries to open the database.
$result = sqlite_query($db, "select cookiename from $table ORDER BY artist, songname"); //Gets all of the music from the database, ordered first by Arist, then by songname
while ($row=sqlite_fetch_array($result)) {
$moo = $row['cookiename'];
$result2 = sqlite_query($db, "select * from $table where cookiename = '$moo'");//Gets the information from the database where the cookiename is that of the one stored in the cookie
$result2 = sqlite_fetch_array($result2);
return "<option value="".$row['cookiename']."">".stripslashes($result2['artist'])." - ".stripslashes($result2['songname'])."</option>";
}//Closes the while statement (By default, its on line 13)
?>
return "</select><br><input type="submit" name="Submit" value="Submit">
<?php
} else {
die ($sqliteerror);//If the database could not be opened, it will return this error
}//Closes the database opening if statement (By default, its on line 11)
}