Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("Content-Type:application/json");
- header("Access-Control-Allow-Origin: *");
- $user = "kikit_app";
- $pass = "OP3N%8bSFx?,";
- $table = "kikit_app";
- $db=new PDO("mysql:host=localhost;dbname=$table", $user, $pass);
- $query = "SELECT * FROM steps";
- try {
- $stmt = $db->query($query);
- }
- catch (PDOException $ex) {
- $response["success"] = 0;
- $response["message"] = "Database Error.";
- die(json_encode($response));
- }
- $rows = $stmt->fetchAll();
- if($rows) {
- $response["success"] = 1;
- $response["message"] = "Step";
- $response["step"] = array();
- foreach ($rows as $row) {
- $post = array();
- $post["id"] = $row["intID"];
- $post["heading"] = $row["strStepheading"];
- $post["keyPrinciple"] = $row["strKeyPrinciple"];
- $post["pillar"] = $row["strPillar"];
- $post["introduction"] = $row["memIntroduction"];
- $post["actionSteps"] = $row["memActionSteps"];
- $post["actionPoints"] = $row["memActionPoints"];
- $post["studyAndUnderstanding"] = $row["memStudyUnderstanding"];
- array_push($response["step"], $post);
- }
- echo json_encode($response);
- }
- else {
- $response["success"] = 0;
- $response["message"] = "No Steps Available";
- die(json_encode($response));
- }
- ?>
- {"success":1,
- "message":
- "Step",
- "step":[{"id":"1",
- "heading":"Test Heading",
- "keyPrinciple":"Key Principle: Test Key Principle",
- "pillar":"Pillar 1: Pillar",
- "introduction":null,
- "actionSteps":null,
- "actionPoints":null,
- "studyAndUnderstanding":null}]}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement