function get_two_days() { include "devotional.php"; //$title=get_two_days("title"); $did = get_datan("did"); $var = new Devotional(); $var->twodays_devotion(); $row = $var->fetch(); if (!$row) { echo "{"; echo jsonn("result", 0) . ","; echo jsons("message", "devotion unavailable"); echo "}"; return; } echo "{"; echo jsonn("result", 1) . ","; echo '"devotion":{'; echo jsons("title", $row['title']) . ","; echo jsons("date", $row['date']) . ","; echo jsons("verse", $row['verse']) . ","; echo jsons("bible_reading", $row['bible_reading']) . ","; echo jsons("devotional_reading", $row['devotional_reading']) . ","; echo jsons("prayer", $row['prayer']); echo "}"; echo "}"; }
function addItem() { //$id=get_datan("fileId"); $filename = get_data("fName"); $description = get_data("description"); $file_type = get_data("fileType"); $fullname = get_data("fullname"); $email = get_data("email"); $date = get_datan("date"); $contact = get_datan("contact"); $conn = mysql_connect(DBHOST, DBUSER, DBPW); if (!$conn) { die('Could not connect: ' . mysql_error()); } $db = mysql_select_db(DBNAME, $conn) or die(mysql_error()); if ($db) { $query = "INSERT INTO data_saver_files(name, type, description, full_name, email, contact, date_added) VALUES('{$filename}','{$file_type}','{$description}','{$fullname}','{$email}',{$contact}, now())"; $result = mysql_query($query); echo mysql_error(); //$info = mysql_fetch_assoc($result); } if (!$result) { echo "{"; echo jsonn("result", 0) . ","; echo jsons("message", "add was not successful"); echo "}"; return; } echo "{"; echo jsonn("result", 1) . ","; echo jsons("message", "add was successful"); echo "}"; }
<?php // @author: Kwabena Gyekye Ohene-Bonsu include_once "gen.php"; include_once 'adb.php'; $cmd = get_datan("cmd"); switch ($cmd) { case 2: getLeaveType(); break; case 3: get_request_by_id($id); break; case 4: send_leave_request(); break; case 5: see_all_my_requests($id); break; case 6: check_my_days_left($id); break; case 7: update_leave_request($id); break; // default: // echo "{"; // echo jsonn("result", 0). ","; // echo jsons("message","unknown command"); // echo "}"; }