sql - PHP & MYSQL: How to resolve ambiguous column names in JOIN operation? -


i have 2 tables in database:

news ('id' - news id, 'user' - user id of author)

users ('id' - user id)

i want make select * news join users on news.user = user.id, when results in php it's like:

$row = mysql_fetch_array($result), , column names $row['column-name']... how news id , user id, having same column name?

update: quick answers. aliases seem best solution.

you can set aliases columns selecting:

$query = 'select news.id newsid, user.id userid, [other fields here] news join users on news.user = user.id' 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -