Answer the question
In order to leave comments, you need to log in
Cause of error when connecting MySQL database?
I tried different types of connected Mysql databases, but still the interpreter swears forever on this line
$connection = mysqli_connect('localhost', 'project_user', '', 'project_db');
function Mysqli_Query_index() {
$connection = mysqli_connect('localhost', 'project_user', '', 'project_db');
if(!$connection){
printf("Ошибка подключения: %s\n", mysqli_connect_error());
exit();
}
else {
printf("Информация хоста: %s\n", mysqli_get_host_info($connection));
}
printf( $connection );
$result = mysqli_query("SELECT * FROM news");
while($row = mysqli_fetch_assoc($result)): ?>
<div class="news-block">
<a href="news.php?id=<?=$row_index['id']?>"><?=$row_index['title']?></a></h1>
<a href="#">№<?=$row_index['id']?></a>
<p class="content"><?=$row_index['main_content']?></p>
<span>Автор: <b><?=$row_index['added']?>,</b></span>
<span>Дата: <b><?=$row_index['add_date']?>,</b></span>
<a href="#" class="read_more">Подробнее...</a>
<hr>
</div> <? endwhile;
}
Answer the question
In order to leave comments, you need to log in
это не ошибка, а предупреждение проверяйте пароль и логин и наличия прав у пользователя для работы с конкретной базой данных в вашем случае project_db
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question