Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
# PHP JavaScript Developer Test

A simple test for PHP / JavaScript Developers
## Undertaken by Thomas Whittington

I've got the website running as per the instructions (which I've left below). I'm happy to send evidence of it working if requested.

## Instructions

I hosted this website using WAMP 3.0.6, and running it assumes it's unpacked into the root folder (wamp64/wwww/ for me).

I've attached an SQL which should create the database and table as per how it was when I was finished with it, minus data. You'll need to edit the database connection file, located at model/database.php.

Everything takes place on Index. CSV importing is automatic (if there is nothing in the database already) and pressing the button shows the customers in a table below.

## Dependencies and Comments

The only real dependency for this is PHPExcel. Bootstrap is used as a part of my personal framework, which this test website is based in.

I'm aware PHPExcel is depreciated, but not only do I know it more than PHPSpreadsheet, I've spent hours trying to get Composer to work on my laptop, only for it to fail.
On that topic, I'm sorry I've not shrunk the dependencies down or made a composer.json file for you, but I can't confirm if it would work.

Feedback is greatly appreciated, please don't hesitate to contact me if you need anything.

I thoroughly enjoyed my interview, and I look forward to hearing positively from you.


# A simple test for PHP / JavaScript Developers

## Instructions

Expand Down
34 changes: 34 additions & 0 deletions catchtest.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
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 */;

CREATE DATABASE IF NOT EXISTS `catchtest` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `catchtest`;

CREATE TABLE `customers` (
`id` int(4) NOT NULL,
`fName` varbinary(255) NOT NULL,
`lName` varbinary(255) NOT NULL,
`email` varbinary(255) NOT NULL,
`gender` tinyint(1) NOT NULL,
`ipAdd` varchar(15) NOT NULL,
`company` varchar(255) NOT NULL,
`city` varbinary(255) NOT NULL,
`title` varchar(255) NOT NULL,
`website` varchar(255) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


ALTER TABLE `customers`
ADD PRIMARY KEY (`id`);


ALTER TABLE `customers`
MODIFY `id` int(4) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7533;
/*!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 */;
18 changes: 18 additions & 0 deletions controller/customers/populateCustomers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
include($_SERVER['DOCUMENT_ROOT']."/model/database.php");
include($_SERVER['DOCUMENT_ROOT']."/model/customer/populateDB.php");

Global $db;
$populateDB = new populateDB;

function checkDatabase($db, $populateDB){
$result = null;
$result = $db->query("SELECT COUNT(*) FROM customers")->fetchColumn();
if ($result == 0) {
$populateDB->readCSV();
}
}

checkDatabase($db, $populateDB);

?>
Loading