function addTransaction($sid, $tid, $class, $duration) { $dbQuery = sprintf("INSERT INTO Transaction (S_ID,T_ID,Class,Duration) VALUES ('%d','%d','%d','%d')", $sid, $tid, $class, $duration); $result = getDBResultInserted($dbQuery, 'ID'); //header("Content-type: application/json"); echo json_encode($result); }
function getSchedule($TID, $Day, $Start, $End) { $dbQuery = sprintf("SELECT * from Schedule WHERE TID ='%d'", $TID, mysql_real_escape_string($Day), $Start, $End); $result = getDBResultInserted($dbQuery, 'TID'); //header("Content-type: application/json"); echo json_encode($result); }
function addStudent($name, $gender, $email, $phone) { $dbQuery = sprintf("INSERT INTO Student (name,gender,email,phone) VALUES ('%s','%d','%s','%d')", mysql_real_escape_string($name), $gender, mysql_real_escape_string($email), $phone); $result = getDBResultInserted($dbQuery, 'ID'); //header("Content-type: application/json"); echo json_encode($result); }
function inputAliasName($aliasName) { global $_USER; $user = $_USER['uid']; $query = sprintf("UPDATE Mentor SET alias = '%s' WHERE username = '******'", $aliasName, $user); $queryRestult = getDBResultInserted($query); header("Content-type: application/json"); echo json_encode($queryResult); }
function addComment($comment) { $dbQuery = sprintf("INSERT INTO comments (comment) VALUES ('%s')", mysql_real_escape_string($comment)); $result = getDBResultInserted($dbQuery, 'personId'); header("Content-type: application/json"); echo json_encode($result); }
function addUser($user, $pw) { $dbQuery = sprintf("Insert into User_Info where NAME = '%s'and PASSWORD = '******'", mysql_real_escape_string($user), mysql_real_escape_string($pw)); $result = getDBResultInserted($dbQuery); echo json_encode($result); }
function addTutor($name, $gender, $phone, $email, $class, $year, $major, $password) { $dbQuery = sprintf("INSERT INTO Tutor (name,gender, phone, email, class, year, major,password) VALUES ('%s','%d', '%d', \n'%s', '%d', '%d', '%d',%s)", mysql_real_escape_string($name), $gender, $phone, mysql_real_escape_string($email), $class, $year, $major, mysql_real_escape_string($password)); $result = getDBResultInserted($dbQuery, 'ID'); echo json_encode($result); }