Just started learning php (right in practice). I ask for your help. I need to display the name of the news, which is equal to the news id. News text, which is equal to news id. And you need to display the date of the news, which is equal to the news id. But, unfortunately, I can not figure out how to do it. Help, please, I do not have enough knowledge.
<?php // Новости $get_rows_news = $mysqli->query("SELECT id FROM news"); $rows_news = mysqli_num_rows($get_rows_news); $get_date_news = $mysqli->query("SELECT 'date' FROM news"); $get_text_news = $mysqli->query("SELECT 'text' FROM news"); $get_name_news = $mysqli->query("SELECT 'name' FROM news"); for($i=0; $i < $rows_news ; ++$i){ ?> <div class="smart-container"> <div class="titlenews"> <?php echo "Название новости" ?> <span class="newsdate"> <?php echo "Дата новости"; ?> </span> </div> <div class="textnews"> <p>Текст новости</p> </div> </div> <?php } ?>
select id, date, text, name from news where id=?, bind using php.net/manual/ru/mysqli-stmt.bind-param.php the desired id value and execute the query. He will immediately return all the required fields from one single record with the specified id - Mike