joycedbdisconnect.php

<!–Chris entered this onto Joyce’s page by opening her file in TextWrangler, saving it to desktop, opening it and highlighting it, then dragging it into a text module on the new page “joycedbdisconnect.php” and then linking it on Joyce’s page Divi backside under Joyce’s Nav. It can be edited from here–>

<!– dbconnect.php file
created by: Joyce Doorn
date: 10/14/2018
Purpose: Create a Poll –>

<?php

/*
— Database
DROP DATABASE IF EXISTS wp_poll1;

— CREATE DATABASE
CREATE DATABASE IF NOT EXISTS wp_poll1;

— Use Database
USE wp_poll1;

— phpMyAdmin SQL Dump
— version 4.8.3
— https://www.phpmyadmin.net/

— Host: 127.0.0.1
— Generation Time: Oct 25, 2018 at 04:49 PM
— Server version: 10.1.35-MariaDB
— PHP Version: 7.2.9

SET SQL_MODE = “NO_AUTO_VALUE_ON_ZERO”;
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = “+00:00″;

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*

— Database: `wp_poll1`

— ——————————————————–


— Table structure for table `tbl_poll_a`

CREATE TABLE `tbl_poll_a` (
`aQuestionNumber` int(2) NOT NULL,
`aResponse` VARCHAR(250) NOT NULL,
`aComment` varchar(250) DEFAULT NULL,
`aResponse_Id` int(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

— ——————————————————–


— Table structure for table `tbl_poll_q`

CREATE TABLE `tbl_poll_q` (
`qQuestionNumber` int(2) NOT NULL,
`qQuestion` varchar(250) NOT NULL,
`qResponse1` varchar(50) NOT NULL,
`qResponse2` varchar(50) NOT NULL,
`qResponse3` varchar(50) NOT NULL,
`qResponse4` varchar(50) NOT NULL,
`qIncludeComment` tinyint(1) DEFAULT NULL,
`qQuestion_Id` int(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


— Dumping data for table `tbl_poll_q`

INSERT INTO `tbl_poll_q` (`qQuestionNumber`, `qQuestion`, `qResponse1`, `qResponse2`, `qResponse3`, `qResponse4`, `qIncludeComment`, `qQuestion_Id`) VALUES
(1, ‘Should undocumented immigrants enjoy the same civil rights protections as U.S. citizens?’, ‘Yes’, ‘Maybe’, ‘No’, ‘People Blog, please specify:’, 1, 1),
(2, ‘Does the Federal Government have too much power to overrule State laws?’, ‘Yes’, ‘The Balance is about right’, ‘No’, ‘Union Blog, please specify:’, 1, 3),
(3, ‘Is the Supreme Court independent enough of partisan politics?’, ‘Yes’, ‘No’, ‘No opinion’, ‘Justice Blog, please specify:’, 1, 4);


— Indexes for dumped tables


— Indexes for table `tbl_poll_a`

ALTER TABLE `tbl_poll_a`
ADD PRIMARY KEY (`aResponse_Id`);


— Indexes for table `tbl_poll_q`

ALTER TABLE `tbl_poll_q`
ADD PRIMARY KEY (`qQuestion_Id`),
ADD UNIQUE KEY `QuestionNumber` (`qQuestionNumber`);


— AUTO_INCREMENT for dumped tables


— AUTO_INCREMENT for table `tbl_poll_a`

ALTER TABLE `tbl_poll_a`
MODIFY `aResponse_Id` int(6) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;


— AUTO_INCREMENT for table `tbl_poll_q`

ALTER TABLE `tbl_poll_q`
MODIFY `qQuestion_Id` int(6) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

// connect to database
try
{

$pdo = new PDO(‘mysql:host=127.0.0.1;dbname=wp_poll1′,’jdoorn’,”);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

// only for educational purposes
$dbstatus = “Good database connection<br>”;

}
catch(PDOException $e)
{
$dbstatus = ‘Database connection failed<br>’.
$e->getMessage();
$die();
}
SESSION_START();

?>