Created
October 23, 2016 20:49
-
-
Save kingsukhoi/4e501b09c28ae1c392d3f34e2928d994 to your computer and use it in GitHub Desktop.
Sort of working project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BobbyProject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="WEB_MODULE" version="4"> | |
<component name="NewModuleRootManager"> | |
<content url="file://$MODULE_DIR$" /> | |
<orderEntry type="inheritedJdk" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
</component> | |
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<component name="CopyrightManager"> | |
<settings default="" /> | |
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="DataSourceManagerImpl" format="xml" multifile-model="true"> | |
<data-source source="LOCAL" name="MySQL - @localhost" uuid="77657d69-801b-4ed3-88c0-95d736d55764"> | |
<driver-ref>mysql</driver-ref> | |
<synchronize>true</synchronize> | |
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver> | |
<jdbc-url>jdbc:mysql://localhost:3306</jdbc-url> | |
<driver-properties> | |
<property name="autoReconnect" value="true" /> | |
<property name="zeroDateTimeBehavior" value="convertToNull" /> | |
<property name="tinyInt1isBit" value="false" /> | |
<property name="characterEncoding" value="utf8" /> | |
<property name="characterSetResults" value="utf8" /> | |
<property name="yearIsDateType" value="false" /> | |
</driver-properties> | |
</data-source> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<dataSource name="MySQL - @localhost"> | |
<database-model serializer="dbm" rdbms="MYSQL" format-version="2.6"> | |
<schema id="1" name="BobbyTest"> | |
<visible>1</visible> | |
</schema> | |
<schema id="2" name="information_schema"/> | |
<schema id="3" name="mysql"/> | |
<schema id="4" name="performance_schema"/> | |
<schema id="5" name="Questions"/> | |
<table id="6" parent="1" name="Business"/> | |
<table id="7" parent="1" name="Human"/> | |
<table id="8" parent="1" name="Jobs"> | |
<comment>Postions open at a business</comment> | |
</table> | |
<table id="9" parent="1" name="Candidate"/> | |
<column id="10" parent="6" name="ID"> | |
<mandatory>1</mandatory> | |
<data-type>int(11)|0</data-type> | |
<sequence-identity>1</sequence-identity> | |
</column> | |
<column id="11" parent="6" name="Name"> | |
<mandatory>1</mandatory> | |
<data-type>text|0</data-type> | |
</column> | |
<key id="12" parent="6" name="PRIMARY"> | |
<columns>ID</columns> | |
<primary>1</primary> | |
</key> | |
<column id="13" parent="7" name="ID"> | |
<mandatory>1</mandatory> | |
<data-type>int(11)|0</data-type> | |
<sequence-identity>1</sequence-identity> | |
</column> | |
<column id="14" parent="7" name="Name"> | |
<data-type>text|0</data-type> | |
</column> | |
<key id="15" parent="7" name="PRIMARY"> | |
<columns>ID</columns> | |
<primary>1</primary> | |
</key> | |
<column id="16" parent="8" name="ID"> | |
<mandatory>1</mandatory> | |
<data-type>int(11)|0</data-type> | |
<sequence-identity>1</sequence-identity> | |
</column> | |
<column id="17" parent="8" name="BusinessID"> | |
<data-type>int(11)|0</data-type> | |
</column> | |
<column id="18" parent="8" name="EmployeeID"> | |
<data-type>int(11)|0</data-type> | |
</column> | |
<column id="19" parent="8" name="StartTime"> | |
<mandatory>1</mandatory> | |
<data-type>time|0</data-type> | |
</column> | |
<column id="20" parent="8" name="EndTime"> | |
<data-type>time|0</data-type> | |
</column> | |
<column id="21" parent="8" name="Description"> | |
<data-type>longtext|0</data-type> | |
</column> | |
<column id="22" parent="8" name="Salary"> | |
<mandatory>1</mandatory> | |
<data-type>double|0</data-type> | |
</column> | |
<index id="23" parent="8" name="Jobs_Business_ID_fk"> | |
<columns>BusinessID</columns> | |
<desc-columns></desc-columns> | |
</index> | |
<index id="24" parent="8" name="Jobs_Human_ID_fk"> | |
<columns>EmployeeID</columns> | |
<desc-columns></desc-columns> | |
</index> | |
<index id="25" parent="8" name="Jobs_ID_uindex"> | |
<columns>ID</columns> | |
<desc-columns></desc-columns> | |
<unique>1</unique> | |
</index> | |
<key id="26" parent="8" name="PRIMARY"> | |
<columns>ID</columns> | |
<primary>1</primary> | |
</key> | |
<key id="27" parent="8" name="Jobs_ID_uindex"> | |
<columns>ID</columns> | |
<underlying-index>Jobs_ID_uindex</underlying-index> | |
</key> | |
<foreign-key id="28" parent="8" name="Jobs_Business_ID_fk"> | |
<columns>BusinessID</columns> | |
<ref-key>~.Business.PRIMARY</ref-key> | |
<cascade-update-rule>update</cascade-update-rule> | |
<cascade-delete-rule>delete</cascade-delete-rule> | |
</foreign-key> | |
<foreign-key id="29" parent="8" name="Jobs_Human_ID_fk"> | |
<columns>EmployeeID</columns> | |
<ref-key>~.Human.PRIMARY</ref-key> | |
<cascade-update-rule>update</cascade-update-rule> | |
<cascade-delete-rule>delete</cascade-delete-rule> | |
</foreign-key> | |
<column id="30" parent="9" name="JobID"> | |
<data-type>int(11)|0</data-type> | |
</column> | |
<column id="31" parent="9" name="EmployeeID"> | |
<data-type>int(11)|0</data-type> | |
</column> | |
<index id="32" parent="9" name="Candidate_Human_ID_fk"> | |
<columns>EmployeeID</columns> | |
<desc-columns></desc-columns> | |
</index> | |
<index id="33" parent="9" name="Candidate_Jobs_ID_fk"> | |
<columns>JobID</columns> | |
<desc-columns></desc-columns> | |
</index> | |
<foreign-key id="34" parent="9" name="Candidate_Jobs_ID_fk"> | |
<columns>JobID</columns> | |
<ref-key>~.Jobs.PRIMARY</ref-key> | |
<cascade-update-rule>update</cascade-update-rule> | |
<cascade-delete-rule>delete</cascade-delete-rule> | |
</foreign-key> | |
<foreign-key id="35" parent="9" name="Candidate_Human_ID_fk"> | |
<columns>EmployeeID</columns> | |
<ref-key>~.Human.PRIMARY</ref-key> | |
<cascade-update-rule>update</cascade-update-rule> | |
<cascade-delete-rule>delete</cascade-delete-rule> | |
</foreign-key> | |
</database-model> | |
</dataSource> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectLevelVcsManager" settingsEditedManually="false"> | |
<OptionsSetting value="true" id="Add" /> | |
<OptionsSetting value="true" id="Remove" /> | |
<OptionsSetting value="true" id="Checkout" /> | |
<OptionsSetting value="true" id="Update" /> | |
<OptionsSetting value="true" id="Status" /> | |
<OptionsSetting value="true" id="Edit" /> | |
<ConfirmationsSetting value="0" id="Add" /> | |
<ConfirmationsSetting value="0" id="Remove" /> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/../BobbyProject/.idea/BobbyProject.iml" filepath="$PROJECT_DIR$/../BobbyProject/.idea/BobbyProject.iml" /> | |
</modules> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="PhpProjectSharedConfiguration" php_language_level="7" /> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
</head> | |
<body> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Created by PhpStorm. | |
* User: farsos | |
* Date: 22/10/16 | |
* Time: 7:23 PM | |
*/ | |
class Helper | |
{ | |
private static $host = "127.0.0.1"; | |
private static $db = 'BobbyTest'; | |
private static $user = 'farsos'; | |
private static $pass = 'cell00highway'; | |
private static $charset = 'utf8'; | |
public static function ConnectDB() | |
{ | |
$dsn="mysql:host=".self::$host.";dbname=".self::$db."; charset:".self::$charset; | |
$opt = [ | |
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, | |
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, | |
PDO::ATTR_EMULATE_PREPARES => false, | |
]; | |
return new PDO($dsn, self::$user, self::$pass, $opt); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Created by PhpStorm. | |
* User: farsos | |
* Date: 22/10/16 | |
* Time: 8:16 PM | |
* Inserts a new business | |
*/ | |
require "Helper.php"; | |
$name=$_POST["Name"]; | |
$connection = Helper::ConnectDB(); | |
/* | |
* $stmt = $pdo->prepare('SELECT * FROM users WHERE email = :email AND status=:status'); | |
* $stmt->execute(['email' => $email, 'status' => $status]); | |
* $user = $stmt->fetch(); | |
*/ | |
$stmt = $connection->prepare("INSERT INTO BobbyTest.Business (Name) VALUES (:name)"); | |
$stmt->execute(['name'=>$name]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Created by PhpStorm. | |
* User: farsos | |
* Date: 22/10/16 | |
* Time: 7:05 PM | |
* Inserts a new human and the times they want to work | |
*/ | |
require "Helper.php"; | |
$name=$_POST["Name"]; | |
$startTime=$_POST["StartTime"]; | |
$endTime=$_POST["EndTime"]; | |
$connection = Helper::ConnectDB(); | |
$stmt = $connection->prepare("INSERT INTO BobbyTest.Human (Name) VALUES (:name)"); | |
$stmt->execute(['name'=>$name]); | |
$ID = $connection->query("SELECT LAST_INSERT_ID()"); | |
$stmt = $connection->prepare("INSERT INTO BobbyTest.TimeHuman VALUES (:id, :startTime, :endTime)"); | |
$stmt->execute(['id'=>$ID, 'startTime'=>$startTime, 'endTime'=>$endTime]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Created by PhpStorm. | |
* User: farsos | |
* Date: 22/10/16 | |
* Time: 8:51 PM | |
* Inserts a new job into the table | |
*/ | |
require "Helper.php"; | |
$description = $_POST["Description"]; | |
$startTime = $_POST["startTime"]; | |
$endTime = $_POST["endTime"]; | |
$BusinessID = $_POST["BusinessID"]; | |
$Salary = $_POST["Salary"]; | |
$connection = Helper::ConnectDB(); | |
$stmt = $connection->prepare("INSERT INTO BobbyTest.Jobs (BusinessID, StartTime, EndTime, Description, Salary) | |
VALUES (:businessID, :startTime, ;endTime,:description,:salary) "); | |
$stmt->execute(["businessID"=>$BusinessID, "startTime"=>$startTime, "endTime"=>$endTime, "description"=>$description, "salary"=>$Salary]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment