Skip to content

Instantly share code, notes, and snippets.

<?php
$dsn = 'mysql:host=localhost;dbname=MyShop';
$username = 'root';
$password = 'root';
/*
//Option 1 - without using an error page
try {
$db = new PDO($dsn, $username, $password);
} catch (PDOException $e) {
body {
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
CREATE TABLE `reg_users` (
`user_id` int(11) NOT NULL,
`user_name` varchar(25) NOT NULL,
`user_email` varchar(60) NOT NULL,
`user_password` varchar(255) NOT NULL,
`joining_date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Table structure for table `us_presidents`
--
CREATE TABLE `us_presidents` (
`president_id` int(3) NOT NULL,
`president_name` varchar(255) NOT NULL,
`more_info` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
<?php
function slug($text){
// replace non letter or digits by -
$text = preg_replace('~[^pLd]+~u', '-', $text);
// trim
$text = trim($text, '-');
// transliterate
<?php
require_once('includes/db_connect.php');
include 'includes/header.php';
?>
<!-- Page Content -->
<body>
<div class="container"> <!--start container-->
<div class="row"><!--wrap both columns in a row-->
<div class="col-md-8"><!--blog entries column-->
<?php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Bootstrap4 Template for blogging</title>
<!-- Sidebar Widgets Column -->
<div class="col-md-4">
<!-- Categories Widget -->
<div class="card my-4">
<h5 class="card-header">Categories</h5>
<div class="card-block">
<div class="row">
<div class="col-lg-6">
<ul class="list-unstyled mb-0">
<li><a href="#">Web Design</a></li>