# Same name, different tables

**URL:** <https://forum.kirupa.com/t/same-name-different-tables/290555>\
**Category:** programming\
**Created:** [June 16, 2009, 12:27pm UTC](https://forum.kirupa.com/t/same-name-different-tables/290555 "2009-06-16T12:27:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nburlington](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/nburlington/32/1365_2.png) [@nburlington](https://forum.kirupa.com/u/nburlington)\
**Post date:** [June 16, 2009, 12:27pm UTC](https://forum.kirupa.com/t/same-name-different-tables/290555/1 "2009-06-16T12:27:01Z")

</div>

If I have two tables ‘books’ and ‘movies’ and each table holds the name of its product in a ‘name’ column, how can I capture both results with the query while statement below?

“SELECT books.name, movies.name FROM books, movies”

…will get me both columns but since they have the same name, I don’t know how to get them:

```auto
while($line = mysql_fetch_assoc($result)){
echo $line["name"] //Only gets me one column.
//this doesn't work echo $line["books.name"]
}

```
