box
box

Reputation: 161

Use two tables in one php page (mysql)

Trying to retrieve all the data onto one page... I've got this working fine when it's retrieving from one table like so:

$data = mysql_query("SELECT * FROM moduleDetails") 

I've tried doing

("SELECT * FROM moduleDetails, qResponses")

but that doesn't work and is the only thing I can see working.

I've heard about using identifiers? But I'm not quite sure how to use those...

I am new to PHP, any tips/examples would be great.

Upvotes: 0

Views: 111

Answers (1)

Jessica
Jessica

Reputation: 7005

SELECT md.*, qr.*
FROM moduleDetails md
LEFT JOIN qResponses qr
ON qr.joinColumn = md.joinColumn

Whatever column you used to link them together, use as the joinColumn.

Upvotes: 2

Related Questions