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

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

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -