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];

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.