<?php // The function __autoload is the method for loading all the classes being used in the script. Use it at the beginning of every php main // page. function __autoload($class) { require_once $class . '.php'; } $relation = new relationalDbConnections('lala', 'localhost:3306', 'root', 'root'); $array = array("CollegeUrl" => "http://google.com", "CollegePresident" => "Abhinav Khanna"); /** * Example usage of InsertIntoTable. Property1: is the Table You are updating, Property2, the place you are checking for your PrimaryID * Property3 is the Column You are checking exists, Property4 is the CollegeName, Property5 is the primaryKey, * $array is the array of IDs for the insertion. */ //$relation->insertIntoTable("CollegeSummary","CollegeSummary", "CollegeName", "Harvard_University", "CollegeID", $array); //$relation->updateTable("CollegeSummary","CollegeSummary", "CollegeName", "Princeton_University", "CollegeID", $array, "CollegeName = 'Princeton_University'"); $relation->close_db_connection();
<?php // autoloader code // loads classes as needed, eliminates the need for a long list of includes at the top spl_autoload_register(function ($className) { $possibilities = array('../controllers' . DIRECTORY_SEPARATOR . $className . '.php', '../back_end' . DIRECTORY_SEPARATOR . $className . '.php', '../views' . DIRECTORY_SEPARATOR . $className . '.php', $className . '.php'); foreach ($possibilities as $file) { if (file_exists($file)) { require_once $file; return true; } } return false; }); $relation = new relationalDbConnections('lala', 'localhost:3306', 'root', 'root'); $array = array("CollegeUrl" => "http://google.com", "CollegePresident" => "Abhinav Khanna"); /** * Example usage of InsertIntoTable. Property1: is the Table You are updating, Property2, the place you are checking for your PrimaryID * Property3 is the Column You are checking exists, Property4 is the CollegeName, Property5 is the primaryKey, * $array is the array of IDs for the insertion. */ //$relation->insertIntoTable("CollegeSummary","CollegeSummary", "CollegeName", "Harvard_University", "CollegeID", $array); $relation->updateTable("CollegeSummary", "CollegeSummary", "CollegeName", "Princeton_University", "CollegeID", $array, "CollegeName = 'Princeton_University'"); $relation->close_db_connection();
values> default:all, - format: The type of format to return the db contents as values> default:json, php, txt */ /** * MANUAL TEST CASES: * - * - */ // The function __autoload is the method for loading all the classes being used in the script. Use it at the beginning of every php main // page. function __autoload($class) { require_once $class . '.php'; } $dbConnection = new relationalDbConnections('lala', "localhost:8889", "root", "root"); $query = $_GET["query"]; $id = $_GET["id"]; $attribute = $_GET["attribute"]; //$format = $_GET["format"]; $outputcontent = ""; $query = strtolower($query); // lowercases the query, makes it easier for case statements switch ($query) { case 'summary': $query = "CollegeSummary"; break; case 'research': $query = "CollegeResearch"; break; case 'professors':
* conditionkey: * conditionval: */ /** * MANUAL TEST CASES: - http://localhost:8888/counselorWriteAPI.php?tablename=StudentUsers&keytable=StudentUsers&foreignkey=StudentFirstName&foreignkeyval=Ron_Weasley&primarykey=StudentID&arrayofvals=John_Weasley&conditionkey=StudentFirstName&conditionval=Ron_Weasley - http://localhost:8888/counselorWriteAPI.php?tablename=StudentUsers&keytable=StudentUsers&foreignkey=StudentFirstName&foreignkeyval=Harry&primarykey=StudentID&field=StudentName&contentoffield=John&conditionkey=StudentFirstName&conditionval=Harry - http://localhost:8888/counselorWriteAPI.php?tablename=StudentUsers&keytable=StudentUsers&foreignkey=StudentFirstName&foreignkeyval=James&primarykey=StudentID&field=StudentFirstName&contentoffield=John&conditionkey=StudentFirstName&conditionval=James */ // The function __autoload is the method for loading all the classes being used in the script. Use it at the beginning of every php main // page. function __autoload($class) { require_once $class . '.php'; } $dbConnection = new relationalDbConnections('UserProfile', "localhost:8889", "root", "root"); $tablename = $_GET["tablename"]; $keytable = $_GET["keytable"]; $foreignkey = $_GET["foreignkey"]; $foreignkeyval = $_GET["foreignkeyval"]; $primarykey = $_GET["primarykey"]; $field = $_GET["field"]; $contentoffield = $_GET["contentoffield"]; $conditionkey = $_GET["conditionkey"]; $conditionval = $_GET["conditionval"]; // checks for empty parameters, all must be specified if (empty($tablename)) { error_log("The tablename has not been specified."); print 'TABLENAME NOT SPECIFIED'; return false; } else {