<commit_before><?php require( __DIR__ . '/public/includes/header.php');?>
    <body>
        
        <div class="container clearfix">
            <div class="row">
                <div class="col-md-12 mysql">
                    <div class="panel panel-default">
                        
                        <div class="panel-heading">
                        
                            <h1>Php and Mysql</h1>    
                            <?php require_once( __DIR__ . '/public/includes/nav_button.php' ); ?>
                            
                        </div>
                        
                        <div class="panel-body">
                        <?php
                          
                          try {
                          $db = new PDO('mysql:host=localhost;dbname=projectx_db', 'root', 'password');
                          $db->setAttribute( PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
                          $db->exec("SET NAMES 'utf8'" );
                            
                          } catch ( Exception $e ) { 
                          echo "Could not link to mysql database.";
                          exit();
                          }
                          
                          try{
                              $results = $db->query("SELECT post_date, post_content FROM wp_posts");
                              echo "Our query ran ok.";
                          } catch( Exception $e ) {
                              echo "Data could not be retrieved, sorry.";
                              exit();
                          }
                          
                          
                           
                        ?>
                        </div>
                        
                        <div class="panel-footer">
                            
                        </div>
                        
                    </div>
                </div>
            </div>
        </div>
        
<?php require( __DIR__ . '/public/includes/scripts_to_load.php' );?>
        
    </body>
</html><commit_msg>PDO statements<commit_after><?php require( __DIR__ . '/public/includes/header.php');?>
    <body>
        
        <div class="container clearfix">
            <div class="row">
                <div class="col-md-12 mysql">
                    <div class="panel panel-default">
                        
                        <div class="panel-heading">
                        
                            <h1>Php and Mysql</h1>    
                            <?php require_once( __DIR__ . '/public/includes/nav_button.php' ); ?>
                            
                        </div>
                        
                        <div class="panel-body">
                        <?php
                          
                          try {
                          $db = new PDO('mysql:host=localhost;dbname=projectx_db', 'root', 'password');
                          $db->setAttribute( PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
                          $db->exec("SET NAMES 'utf8'" );
                            
                          } catch ( Exception $e ) { 
                          echo "Could not link to mysql database.";
                          exit();
                          }
                          
                          try{
                              $results = $db->query("SELECT post_date, post_content FROM wp_posts");
                          } catch( Exception $e ) {
                              echo "Data could not be retrieved, sorry.";
                              exit();
                          }
                          
                          echo "<pre>";
                          var_dump( $results->fetchall( PDO::FETCH_ASSOC) );
                          echo "</pre>";
                          
                          
                          
                           
                        ?>
                        </div>
                        
                        <div class="panel-footer">
                            
                        </div>
                        
                    </div>
                </div>
            </div>
        </div>
        
<?php require( __DIR__ . '/public/includes/scripts_to_load.php' );?>
        
    </body>
</html>
{'fraction_non_alphanumeric': 0.09774436090225563, 'fraction_numerical': 0.00227842333105491, 'mean_word_length': 0.6235207100591716, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 58, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3044582', 'n_tokens_mistral': 962, 'n_tokens_neox': 918, 'n_words': 178}