Skip to main content
replaced http://meta.stackexchange.com/ with https://meta.stackexchange.com/
Source Link

If you want to embed code in a list, you'll need to precede it with 8 spacesprecede it with 8 spaces instead of the usual 4:

  • include/db.php: <? include_once 'include/config.php';

      try {
    
              $attribs =  
                      array(
                              PDO::ATTR_PERSISTENT => $config['db']['persistent'],
                              PDO::ATTR_ERRMODE => $config['db']['errormode']
                      );
    
    
              $db = new PDO(
                      $config['db']['uri'],
                      $config['db']['user'],
                      $config['db']['pass'],
                      $attribs
              );
              $db->query("SET NAMES 'utf8'");
              $db->query("SET CHARACTER SET 'utf8'");
    
      } catch (PDOException $e) {
              print "Error!: " . $e->getMessage() . "<br/>";
              die();
      }
    
      function dbGetEngine() {
              global $config;
              return substr($config['db']['uri'], 0, strpos($config['db']['uri'], ':'));
      }
      ?>
    
  • include/config.php: <?

      //$config['db']['uri'] = 'sqlite:' . realpath('.') . '/site.db'; // PDO's database access URI
      $config['db']['uri'] = 'mysql:host=localhost;dbname=sitedb'; // server should be : 195.78.32.7
      //$config['db']['uri'] = 'pgsql:host=localhost;dbname=sitedb';
      $config['db']['user'] = 'user_goes_here'; // database username
      $config['db']['pass'] = 'pass_goes_here'; // database password
      $config['db']['persistent'] = false; // should the connection be persistent
      $config['db']['errormode'] = PDO::ERRMODE_EXCEPTION; // PDO's error mode
    
      ?>
    

If you want to embed code in a list, you'll need to precede it with 8 spaces instead of the usual 4:

  • include/db.php: <? include_once 'include/config.php';

      try {
    
              $attribs =  
                      array(
                              PDO::ATTR_PERSISTENT => $config['db']['persistent'],
                              PDO::ATTR_ERRMODE => $config['db']['errormode']
                      );
    
    
              $db = new PDO(
                      $config['db']['uri'],
                      $config['db']['user'],
                      $config['db']['pass'],
                      $attribs
              );
              $db->query("SET NAMES 'utf8'");
              $db->query("SET CHARACTER SET 'utf8'");
    
      } catch (PDOException $e) {
              print "Error!: " . $e->getMessage() . "<br/>";
              die();
      }
    
      function dbGetEngine() {
              global $config;
              return substr($config['db']['uri'], 0, strpos($config['db']['uri'], ':'));
      }
      ?>
    
  • include/config.php: <?

      //$config['db']['uri'] = 'sqlite:' . realpath('.') . '/site.db'; // PDO's database access URI
      $config['db']['uri'] = 'mysql:host=localhost;dbname=sitedb'; // server should be : 195.78.32.7
      //$config['db']['uri'] = 'pgsql:host=localhost;dbname=sitedb';
      $config['db']['user'] = 'user_goes_here'; // database username
      $config['db']['pass'] = 'pass_goes_here'; // database password
      $config['db']['persistent'] = false; // should the connection be persistent
      $config['db']['errormode'] = PDO::ERRMODE_EXCEPTION; // PDO's error mode
    
      ?>
    

If you want to embed code in a list, you'll need to precede it with 8 spaces instead of the usual 4:

  • include/db.php: <? include_once 'include/config.php';

      try {
    
              $attribs =  
                      array(
                              PDO::ATTR_PERSISTENT => $config['db']['persistent'],
                              PDO::ATTR_ERRMODE => $config['db']['errormode']
                      );
    
    
              $db = new PDO(
                      $config['db']['uri'],
                      $config['db']['user'],
                      $config['db']['pass'],
                      $attribs
              );
              $db->query("SET NAMES 'utf8'");
              $db->query("SET CHARACTER SET 'utf8'");
    
      } catch (PDOException $e) {
              print "Error!: " . $e->getMessage() . "<br/>";
              die();
      }
    
      function dbGetEngine() {
              global $config;
              return substr($config['db']['uri'], 0, strpos($config['db']['uri'], ':'));
      }
      ?>
    
  • include/config.php: <?

      //$config['db']['uri'] = 'sqlite:' . realpath('.') . '/site.db'; // PDO's database access URI
      $config['db']['uri'] = 'mysql:host=localhost;dbname=sitedb'; // server should be : 195.78.32.7
      //$config['db']['uri'] = 'pgsql:host=localhost;dbname=sitedb';
      $config['db']['user'] = 'user_goes_here'; // database username
      $config['db']['pass'] = 'pass_goes_here'; // database password
      $config['db']['persistent'] = false; // should the connection be persistent
      $config['db']['errormode'] = PDO::ERRMODE_EXCEPTION; // PDO's error mode
    
      ?>
    
Fixup of bad MSO links to MSE links migration
Source Link
Fixup of bad MSO links to MSE links migration
Source Link
  • include/db.php:   <? include_once 'include/config.php';

      try {
    
              $attribs =  
    
        $attribs =  
                array(
                        PDO::ATTR_PERSISTENT =&gt; $config['db']['persistent'],
                        PDO::ATTR_ERRMODE =&gt; $config['db']['errormode']
                );
    
    
        $db = new PDO(
                $config['db']['uri'],
                $config['db']['user'],
                $config['db']['pass'],
                $attribs
        );
        $db-&gt;query("SET NAMES 'utf8'");
        $db-&gt;query("SET CHARACTER SET 'utf8'");
    
    array(

    } catch (PDOException $e) { print "Error!: " . $e->getMessage() . "<br/>"; die(); }

    PDO::ATTR_PERSISTENT => $config['db']['persistent'],

    function dbGetEngine() { global $config; return substr($config['db']['uri'], 0, strpos($config['db']['uri'], ':')); } ?>

    PDO::ATTR_ERRMODE => $config['db']['errormode'] ); $db = new PDO( $config['db']['uri'], $config['db']['user'], $config['db']['pass'], $attribs ); $db->query("SET NAMES 'utf8'"); $db->query("SET CHARACTER SET 'utf8'"); } catch (PDOException $e) { print "Error!: " . $e->getMessage() . "<br/>"; die(); } function dbGetEngine() { global $config; return substr($config['db']['uri'], 0, strpos($config['db']['uri'], ':')); } ?>
     
  •  
  • include/config.php:   <?

      //$config['db']['uri'] = 'sqlite:' . realpath('.') . '/site.db'; // PDO's database access URI
      $config['db']['uri'] = 'mysql:host=localhost;dbname=sitedb'; // server should be : 195.78.32.7
      //$config['db']['uri'] = 'pgsql:host=localhost;dbname=sitedb';
      $config['db']['user'] = 'user_goes_here'; // database username
      $config['db']['pass'] = 'pass_goes_here'; // database password
      $config['db']['persistent'] = false; // should the connection be persistent
      $config['db']['errormode'] = PDO::ERRMODE_EXCEPTION; // PDO's error mode
     
    
      ?>
    
     
  • include/db.php:  

    try {
    
    
    
        $attribs =  
                array(
                        PDO::ATTR_PERSISTENT =&gt; $config['db']['persistent'],
                        PDO::ATTR_ERRMODE =&gt; $config['db']['errormode']
                );
    
    
        $db = new PDO(
                $config['db']['uri'],
                $config['db']['user'],
                $config['db']['pass'],
                $attribs
        );
        $db-&gt;query("SET NAMES 'utf8'");
        $db-&gt;query("SET CHARACTER SET 'utf8'");
    

    } catch (PDOException $e) { print "Error!: " . $e->getMessage() . "<br/>"; die(); }

    function dbGetEngine() { global $config; return substr($config['db']['uri'], 0, strpos($config['db']['uri'], ':')); } ?>

  •  
  • include/config.php:  

    //$config['db']['uri'] = 'sqlite:' . realpath('.') . '/site.db'; // PDO's database access URI
    $config['db']['uri'] = 'mysql:host=localhost;dbname=sitedb'; // server should be : 195.78.32.7
    //$config['db']['uri'] = 'pgsql:host=localhost;dbname=sitedb';
    $config['db']['user'] = 'user_goes_here'; // database username
    $config['db']['pass'] = 'pass_goes_here'; // database password
    $config['db']['persistent'] = false; // should the connection be persistent
    $config['db']['errormode'] = PDO::ERRMODE_EXCEPTION; // PDO's error mode
     
    
    ?>
    
  • include/db.php: <? include_once 'include/config.php';

      try {
    
              $attribs =  
                      array(
                              PDO::ATTR_PERSISTENT => $config['db']['persistent'],
                              PDO::ATTR_ERRMODE => $config['db']['errormode']
                      );
    
    
              $db = new PDO(
                      $config['db']['uri'],
                      $config['db']['user'],
                      $config['db']['pass'],
                      $attribs
              );
              $db->query("SET NAMES 'utf8'");
              $db->query("SET CHARACTER SET 'utf8'");
    
      } catch (PDOException $e) {
              print "Error!: " . $e->getMessage() . "<br/>";
              die();
      }
    
      function dbGetEngine() {
              global $config;
              return substr($config['db']['uri'], 0, strpos($config['db']['uri'], ':'));
      }
      ?>
    
     
  • include/config.php: <?

      //$config['db']['uri'] = 'sqlite:' . realpath('.') . '/site.db'; // PDO's database access URI
      $config['db']['uri'] = 'mysql:host=localhost;dbname=sitedb'; // server should be : 195.78.32.7
      //$config['db']['uri'] = 'pgsql:host=localhost;dbname=sitedb';
      $config['db']['user'] = 'user_goes_here'; // database username
      $config['db']['pass'] = 'pass_goes_here'; // database password
      $config['db']['persistent'] = false; // should the connection be persistent
      $config['db']['errormode'] = PDO::ERRMODE_EXCEPTION; // PDO's error mode
    
      ?>
    
     
Migration of MSO links to MSE links
Source Link
Loading
Source Link
Kyle Cronin Mod
  • 37.9k
  • 10
  • 89
  • 152
Loading