I have this query:
$result3 = mysql_query("SELECT posts.id, posts.date, posts.title, comments.post, comments.id, comments.date FROM posts, comments WHERE posts.id = comments.post")
or die(mysql_error());
while($row2 = mysql_fetch_array( $result3 )) {
echo $row2['title'];
}
The problem is with the posts.id , posts.date and comments.id , comments.date . How can I get out id, date for both tables $row2['....]; I tried $row2['posts.id']; but it didn’t work!
Name the column in your query (this is called an column alias) like this:
Then you can use:
Edit:
You may also benefit from this question I wrote and answered which discusses many common SQL queries and requests.