HTML
- 14 ответов
- 0 вопросов
4
Вклад в тег
$news = $_GET['id'];
$mysqli = mysqli_connect('localhost', 'weltkind', '123321', 'wl_db');
$sql = "SELECT
n.id AS news_id,
n.title AS title,
n.content AS content,
u.id AS user_id
FROM news n
LEFT JOIN users u
ON n.user_id = u.id
WHERE n.id = $news LIMIT 1
";
$query = mysqli_query($mysqli, $sql);
$row = array();
$row = mysqli_fetch_assoc($query);
echo '<div>';
echo '<h1><a href="news.php?id='.$row['news_id'].'">'.$row['title'].'</a></h1>';
echo '<p>'.$row['content'].'</p>';
echo '</div>';