• 0

MySQL with PHP help


Question

Hi guys, I really do not know how to make this logic out.

Imagine I would like to get albums and their respective songs from a database and have them sorted; each one with a hyperlink of different sites so it gets to .

Example:

There's an Album "A" and the songs:

1. "One" (And by clicking I will be redirected to -> http://some_link.com/one?=blahrs)

2. "Two" (And by clicking I will be redirected to -> http://some_link.com/two?=blahrs)

3. "Three" (And by clicking I will be redirected to -> http://totally_different_link.com/one?=blahrs)

4. "Four"....etc...

And there's an album "B" and the songs:

"Track 1" (Same methodology as Album A)

"Track 2"

"Track 3"

I would like to store this info on a MySQL database, and retrieve them using PHP.

How my logic is up to right now:

Create MySQL columns with id, t_id, track, album, link

Where id is the default id mechanism in which the rows will be numbered in the Database.

Where t_id is the track number on the album;

Where track is the track name of the album

Where album is the name of the album

Where link is where I want to redirect to when clicked.

How I think I should proceed (but do not know how to)

Group each row of the table by Album first, in which many tracks will have the same album (I'm lost on how to do this).

Then to each different group, sort them via their t_id (Track number of the current album) (I'm lost on how to do this).

Display the information with their links (Easy part)

I'm planning to display them as follows:

Name goes here

1

Album track #1

Hyperlink #1

2

Album track #2

Hyperlink #2

I did not know how to Google this out....

Furthermore, am I approaching this problem correctly?

Thanks a lot and sorry for the long post.

Link to comment
https://www.neowin.net/forum/topic/1093831-mysql-with-php-help/
Share on other sites

2 answers to this question

Recommended Posts

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Let Apple have its way, as customers will eschew Apple in favor of more open solutions--which is what they should be doing anyway!... I'm not a fan of Apple at all, but when the lawyers in the EUC start dictating to companies how their software should be made, I think the companies should just drop the EU altogether as a market. EUC lawyers make a mint every time they levy a fine on a successful American software company. What a racket. The EU consumer should be the final word on what products he buys and which ones he doesn't, but the EUC seeks to put itself into the position of the EU customer, and make those decisions for him, under the guise of "helping him." Q. What do you do when the person at your door says, "Hi! I'm from the government, and I'm here to help you make intelligent buying decisions!" A. Grab your possessions and run for the hills...
    • Just another show from my childhood ruined by wokeness 'politically correct' BS. They should let some things just die out gracefully.
    • "Pot meet kettle" "Is the shoe on the other foot?" "It's only okay when I am lying about stuff" F*** off nigel 
    • Some Doctor Who news... 'Doctor Who' Officially Has a New Streaming Home (AMC+) DOCTOR WHO Christmas Special Canceled, Russell T Davies Leaving Show
    • My Xbox One is already the most power efficient console I've ever owned. Haven't turned the thing on in ten years.
  • Recent Achievements

    • First Post
      StaticMatrix earned a badge
      First Post
    • Week One Done
      StaticMatrix earned a badge
      Week One Done
    • Rookie
      lamborghiniv10 went up a rank
      Rookie
    • One Month Later
      pinnclepd earned a badge
      One Month Later
    • First Post
      X-No-file earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      520
    2. 2
      PsYcHoKiLLa
      210
    3. 3
      +Edouard
      147
    4. 4
      Steven P.
      92
    5. 5
      ATLien_0
      80
  • Tell a friend

    Love Neowin? Tell a friend!