Displaying the last post on static homepage

Alright, I think I found my answer.

As I’ve said, I created a new php template in my theme named “New Index” and associated my homepage to it.
This template was at first a copy of the original index.php

Now here is the code I added for it to make what I wanted :

<?php $the_query = new WP_Query( 'posts_per_page=1&category_name=news' ); ?>
<?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>

<div id="last_news">
    <div id="last_news_title"><?php the_title(); ?></div>
    <div id="last_news_time"><?php the_time('j F Y'); ?></div>
    <div id="last_news_content"><?php the_content(); ?></div>
</div>

<?php 
    endwhile;
    wp_reset_postdata();
?>

This may not be the optimal solution though, I’d be curious to hear tips about it.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)