I have two tables 'book' and 'category'. How can I display all the rows from my 'book' table? Note, there is a join between category(book table) and cat_name(category table).
book table
id category title
1 2 a title here
2 2 a title here
3 1 a title here
4 Comedy a title here
5 1 a title here
6 Horror a title here
category table
id cat_name
---- -------
1 Language
2 Kids
Currently I am using the following sql query, it only seems to display rows that have a number for the category, whereas I want all the data. Currently my html table doesn't display rows 4 and 6.
SELECT b.id, b.title, b.category, b.author, b.isbn, b.publicationYear,
c.cat_name
FROM book AS b
INNER JOIN category AS c ON b.category = c.id
Sample of my php
echo '<td>' . $row['id'] . '</td>';
echo '<td>' . $row['title'] . '</td>';
echo '<td>' . $row['cat_name'] . '</td>';
echo '<td>' . $row['author'] . '</td>';
echo '<td>' . $row['isbn'] . '</td>';
Quite new to php/mysql so any advice or direction is appreciated.