php - Select variables from two tables -


i have 2 tables:

comments: id, username, autorpost, comment, id_post, time  posts:  id, autorid, autor, date, longitude, latitude, title, text, town, time 

now want select these rows of table posts username, had saved in cookie $username = $_cookie['username']; have same value how username in table comments. possible or should add columns?

"select     c.id,     c.username,     c.autorpost,     c.comment,     c.id_post,     c.time,     p.id,     p.autorid,     p.autor,     p.date,     p.longitude,     p.latitude,     p.title,p.text,p.town,p.time  comments c  join posts p  on p.id=c.id_post  c.username='".$username."'"; 

Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -