Mysql joining tables

Hey, I need a little help joining two mysql tables. Basically in both tables i have a row named “bib_id”. One table is named “bibs” the other “bib_data”.

The table “bibs” contains the title of an item and “bib_data” contains the data that goes under that item with the same bib_id etc.

So what I need to do is get it so that I can echo the correct information from “bib_data” under the correct title from “bibs”

so it would echo something like this:

TITLE1 FROM BIBS
*INFO1 FROM BIB_DATA FOR TITLE1 FROM BIBS
*INFO2 FROM BIB_DATA FOR TITLE1 FROM BIBS
*INFO4 FROM BIB_DATA FOR TITLE1 FROM BIBS

TITLE2 FROM BIBS
*INFO3 FROM BIB_DATA FOR TITLE2 FROM BIBS
*INFO5 FROM BIB_DATA FOR TITLE2 FROM BIBS

etc… If that makes any sense?

I’ve been having ago, but I’ve had no luck


$sql = "SELECT bibs.bib_id, bib_data.bib_id FROM bibs, bib_data WHERE bibs.bib_id = bib_data.bib_id";

What I have done above is more than likely waaay off the mark of what is suppose to be.

The row that contains the info “bib_data” is also named bib_data. Incase what I have done doesn’t make sense. I also need to filter the results by username/id in “bibs” I have a row named user etc…

If you have any advice, tips or tutorials that you know of, it would be a great help.

Thank you :slight_smile: