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
Post a Comment