Question: Requirements Install MySQL. The easiest way is using docker. Warning to Windows users: docker might not work if you aren't using Windows 10 Professional version.
Requirements
Install MySQL. The easiest way is using docker. Warning to Windows users: docker might not work if you aren't using Windows 10 Professional version. Mileage varies with other versions. Time box your attempt. If it doesn't work, get a VM of Ubuntu with docker. Get Hello World working in MySQL console, then from PHP to MySQL. There are several ways to connect PHP to MySQL. Use whichever one works for you.
Install the table creation scripts manually from console. You can use this script
http://sqlfiddle.com/#!9/f47627
Generate realistic fake data for 1,000 rows each for cats, dogs, exotics, owners, and notes. Use faker.jsfor most of the heavy lifting. Mix up the number of rows in the many to many relationships. 1 owner has 6 cats, and no dogs/exotics. Another has a cat, 2 dogs, and a rat. Another has ... MIX IT UP. You will probably need to do some once only (AKA throw away) code. DO NOT MIX IT IN WITH YOUR NORMAL RUNNING CODE. Keep separate the code for setup, and for sample data, and for normal ongoing operation. Notes should have dates and names in English, but the rest should be Lorem Ipsum. Don't start with the same phrase. Don't have the same length.
Wrong
Note 1: June 6, 2018 | Joe Camel Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Note 2: August 12, 2017 | Djarum Black Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Note 3: May 3, 2017 | Virginia Slims Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Right
Note 1: June 6, 2018 | Joe Camel Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Note 2: August 12, 2017 | Djarum Black Anim id est laborum.
Note 3: May 3, 2017 | Virginia Slims Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
See code below:
Admin.html
-
Home
-
Contact
-
About
-
Dog
-
Cat
-
Exotic
Pets to Care
Home
Vet
Cynthia (Owner)
Triska (Practice Manager)
3 Partners (Cynthia, Husband, and two others)
2 new vets
Pets to Care
Contact
5700 W 3400 S,
Taylorsville, UT 84129
(801) 948-2000
Pets to Care
About us
Pet Medical Center has been serving Taylorsville, Utah pet owners since 1964. From its humble beginning
in a remodeled fruit stand and with the name "Utah Valley Veterinary Hospital", Pet Medical Center has
become a full-service, sophisticated small animal pet care facility providing comprehensive medical,
surgical and dental care. Our team of veterinarians, veterinarian technicians, assistants, and kennel
workers highly value your family pet. Team work is a key element continuously employed in our daily
practice. Pet Medical Center strives to offer and provide the most comprehensive pet care available in the
Provo-Orem area as well as throughout other communities in Utah County. Our mission is to provide the highest
quality veterinary care for our patients and clients. A healthy pet is a happy per and that is what we want
most for our patients and their families. Additionally, Pet Medical Center provides unique services for owners
and breeders through its sister clinic in Draper, Utah, South Mountain Pet Care, where specialized work in
reproductive medical care is provided. We also provide a variety of pet products such as pet shampoos,
nail clippers, treats, etc., and Hills Diet dog and cat food that can also meet special diets and needs for
your family pet.
Pets to Care
Dog Filterable Table
| Name | Breed | Sex | Shots | Age | Size | Licensed | Neutered | Owners | Notes |
|---|---|---|---|---|---|---|---|---|---|
| Rocky | Bulldog | Male | True | 10 | Large | True | False | Adam | None |
| Snowflake | Husky | Male | True | 12 | Large | True | False | Henry | None |
| Lassie | Poodle | Female | True | 8 | Small | True | False | Susan | None |
$(document).ready(function(){
$("#myInput").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#myTable tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
Pets to Care
Cat Filterable Table
| Name | Breed | Sex | Shots | Age | Declawed | Neutered | Owners | Notes |
|---|---|---|---|---|---|---|---|---|
| Pepper | Korat | Male | True | 2 | True | False | Linda | None |
| Salt | Manx | Male | True | 4 | True | False | Lindsay | None |
| Tiger | Bengal | Female | True | 9 | True | True | Patrick | None |
$(document).ready(function(){
$("#myInput").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#myTable tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
Pets to Care
Exotic Filterable Table
| Name | Species | Sex | Age | Size | Owners | Notes |
|---|---|---|---|---|---|---|
| Captain | Horse | Male | 5 | Medium | Cassie | None |
| Pancake | Bunny | Female | 2 | Small | Cassie | None |
| Feathers | Chicken | Female | 3 | Small | Jann | None |
$(document).ready(function(){
$("#myInput").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#myTable tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
function sortTable() {
var table, rows, switching, i, x, y, shouldSwitch;
table = document.getElementById("myTable");
switching = true;
/*Make a loop that will continue until
no switching has been done:*/
while (switching) {
//start by saying: no switching is done:
switching = false;
rows = table.getElementsByTagName("TR");
/*Loop through all table rows (except the
first, which contains table headers):*/
for (i = 1; i < (rows.length - 1); i++) {
//start by saying there should be no switching:
shouldSwitch = false;
/*Get the two elements you want to compare,
one from current row and one from the next:*/
x = rows[i].getElementsByTagName("TD")[0];
y = rows[i + 1].getElementsByTagName("TD")[0];
//check if the two rows should switch place:
if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {
//if so, mark as a switch and break the loop:
shouldSwitch = true;
break;
}
}
if (shouldSwitch) {
/*If a switch has been marked, make the switch
and mark that a switch has been done:*/
rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
switching = true;
}
}
}
Public.html
-
Home
-
Contact
-
About
Pets to Care
Home
Vet
Cynthia (Owner)
Triska (Practice Manager)
3 Partners (Cynthia, Husband, and two others)
2 new vets
Pets to Care
Contact
5700 W 3400 S,
Taylorsville, UT 84129
(801) 948-2000
Pets to Care
About us
Pet Medical Center has been serving Taylorsville, Utah pet owners since 1964. From its humble beginning
in a remodeled fruit stand and with the name "Utah Valley Veterinary Hospital", Pet Medical Center has
become a full-service, sophisticated small animal pet care facility providing comprehensive medical,
surgical and dental care. Our team of veterinarians, veterinarian technicians, assistants, and kennel
workers highly value your family pet. Team work is a key element continuously employed in our daily
practice. Pet Medical Center strives to offer and provide the most comprehensive pet care available in the
Provo-Orem area as well as throughout other communities in Utah County. Our mission is to provide the highest
quality veterinary care for our patients and clients. A healthy pet is a happy per and that is what we want
most for our patients and their families. Additionally, Pet Medical Center provides unique services for owners
and breeders through its sister clinic in Draper, Utah, South Mountain Pet Care, where specialized work in
reproductive medical care is provided. We also provide a variety of pet products such as pet shampoos,
nail clippers, treats, etc., and Hills Diet dog and cat food that can also meet special diets and needs for
your family pet.
Cats.js
$.ajax({
url: '/echo/json/',
type: "post",
dataType: "json",
data: {
json: JSON.stringify([
{
"name": "Pepper",
"breed": "Korat",
"sex": "Male",
"shots": "True",
"age": "2",
"declawed": "True",
"neutered": "False",
"owners": "Linda",
"notes": "None"
},
{
"name": "Salt",
"breed": "Manx",
"sex": "Male",
"shots": "True",
"age": "4",
"declawed": "True",
"neutered": "False",
"owners": "Lindsay",
"notes": "None"
},
{
"name": "Bengal",
"breed": "",
"sex": "Female",
"shots": "True",
"age": "9",
"declawed": "True",
"neutered": "True",
"owners": "Patrick",
"notes": "None"
}
]),
delay: 1
},
success: function(data, textStatus, jqXHR) {
drawTable(data);
}
});
function drawTable(data) {
for (var i = 0; i < data.length; i++) {
drawRow(data[i]);
}
}
function drawRow(rowData) {
var row = $("
$("#tblDogs").append(row);
row.append($("
row.append($("
row.append($("
row.append($("
row.append($("
row.append($("
row.append($("
row.append($("
row.append($("
}
Cats.json
[
{
"name": "Pepper",
"breed": "Korat",
"sex": "Male",
"shots": "True",
"age": "2",
"declawed": "True",
"neutered": "False",
"owners": "Linda",
"notes": "None"
},
{
"name": "Salt",
"breed": "Manx",
"sex": "Male",
"shots": "True",
"age": "4",
"declawed": "True",
"neutered": "False",
"owners": "Lindsay",
"notes": "None"
},
{
"name": "Bengal",
"breed": "Bengal",
"sex": "Female",
"shots": "True",
"age": "9",
"declawed": "True",
"neutered": "True",
"owners": "Patrick",
"notes": "None"
}
]
Dogs.js
$.ajax({
url: '/echo/json/',
type: "post",
dataType: "json",
data: {
json: JSON.stringify([
{
"name": "Rocky",
"breed": "Bulldog",
"sex": "Male",
"shots": "True",
"age": "10",
"size": "Large",
"licenced": "True",
"neutered": "False",
"owners": "Adam",
"notes": "None"
},
{
"name": "Snowflake",
"breed": "Husky",
"sex": "Male",
"shots": "True",
"age": "12",
"size": "Large",
"licenced": "True",
"neutered": "False",
"owners": "Henry",
"notes": "None"
},
{
"name": "Lassie",
"breed": "$Poodle",
"sex": "Female",
"shots": "True",
"age": "8",
"size": "Small",
"licenced": "True",
"neutered": "False",
"owners": "Susan",
"notes": "None"
}
]),
delay: 1
},
success: function(data, textStatus, jqXHR) {
drawTable(data);
}
});
function drawTable(data) {
for (var i = 0; i < data.length; i++) {
drawRow(data[i]);
}
}
function drawRow(rowData) {
var row = $("
$("#tblDogs").append(row);
row.append($("
row.append($("
row.append($("
row.append($("
row.append($("
row.append($("
row.append($("
row.append($("
row.append($("
row.append($("
}
Dogs.json
[
{
"name": "Rocky",
"breed": "Bulldog",
"sex": "Male",
"shots": "True",
"age": "10",
"size": "Large",
"licenced": "True",
"neutered": "False",
"owners": "Adam",
"notes": "None"
},
{
"name": "Snowflake",
"breed": "Husky",
"sex": "Male",
"shots": "True",
"age": "12",
"size": "Large",
"licenced": "True",
"neutered": "False",
"owners": "Henry",
"notes": "None"
},
{
"name": "Lassie",
"breed": "Poodle",
"sex": "Female",
"shots": "True",
"age": "8",
"size": "Small",
"licenced": "True",
"neutered": "False",
"owners": "Susan",
"notes": "None"
}
]
Exotic.js
$.ajax({
url: '/echo/json/',
type: "post",
dataType: "json",
data: {
json: JSON.stringify([
{
"name": "Captain",
"species": "Horse",
"sex": "Male",
"age": "5",
"size": "Medium",
"owners": "Cassie",
"notes": "None"
},
{
"name": "Pancake",
"species": "Bunny",
"sex": "Male",
"age": "2",
"size": "Small",
"owners": "Kim",
"notes": "None"
},
{
"name": "Feathers",
"species": "Chicken",
"sex": "Female",
"age": "3",
"size": "Small",
"owners": "Jann",
"notes": "None"
}
]),
delay: 1
},
success: function(data, textStatus, jqXHR) {
drawTable(data);
}
});
function drawTable(data) {
for (var i = 0; i < data.length; i++) {
drawRow(data[i]);
}
}
function drawRow(rowData) {
var row = $("
$("#tblDogs").append(row);
row.append($("
row.append($("
row.append($("
row.append($("
row.append($("
row.append($("
row.append($("
}
Exotic.json
[
{
"name": "Captain",
"species": "Horse",
"sex": "Male",
"age": "5",
"size": "Medium",
"owners": "Cassie",
"notes": "None"
},
{
"name": "Pancake",
"species": "Bunny",
"sex": "Female",
"age": "2",
"size": "Small",
"owners": "Kim",
"notes": "None"
},
{
"name": "Feathers",
"species": "Chicken",
"sex": "Female",
"age": "3",
"size": "Small",
"owners": "Jann",
"notes": "None"
}
]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
