Jump to content

Question with functions and MySQL SELECTING


kts

Recommended Posts

I am trying to select * from a table inside the function and then remotely display it. I know the code I have is wrong, but its what I could try to logically come up with, but I can't find any examples anywhere. If someone wouldn't mind I'd appreciate the help. Thanks a lot.

 

function show_all_lyrics() {
global $show_all_lyrics_row;
$query = "SELECT * FROM lyrics ORDER BY band ASC";
$result = mysql_query($query) or die(mysql_error());
while($show_all_lyrics_row = mysql_fetch_row($result)){
}
}

//$row = while (show_all_lyrics()){
database_connect($host, $user, $pass, $db);
show_all_lyrics();
echo $show_all_lyrics_row[3];

aftering looking into this further, i believe i am taking an incorrect approach. instead of the code does anyone have any good sites to read up more on this topic? or possibly code/tutorial with this topic inside of it?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.