Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $DB_host = "localhost";
- $DB_user = "root";
- $DB_pass = "";
- $DB_name = "news_spots";
- $options = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf-8');
- try
- {
- $DB_con = new PDO("mysql:host={$DB_host};dbname={$DB_name}",$DB_user,$DB_pass);
- $DB_con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $DB_con->exec('SET NAMES utf8');
- }
- catch(PDOException $e)
- {
- $e->getMessage();
- }
- $stmt = $DB_con->prepare("SELECT FROM news");
- while($row=$stmt->fetch(PDO::FETCH_ASSOC))
- {
- echo
- '
- <p style="color:red !important;">'.$row["name_news"].'</p>
- ';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement