/** * Get instance of the class itself * * @return noteDB */ public static function getInstance() { if (!self::$instance instanceof self) { self::$instance = new self(); } return self::$instance; }
<?php /* ================================================================================ REQUEST OF RETURN ALL NOTES -> GET VALUES WITH AJAX author : ELihu Alejandro Cruz Albores version : 1.0.4 ================================================================================ */ include "../NoteDB.php"; $id = $_GET['id']; //Instance $Conection = new NoteDB("WebProject", "localhost", "root", " "); echo $Conection->getAllNotes($id);
<a href="https://github.com/stephenhu3" class="github-link" target="_blank"><img class="logo" src="../img/logo.png">GitHub | Stephen Hu</a> </li> </ul> </div> </div> </nav> <div class="container body-content"> <h2>Notes</h2> <div class="jumbotron" id="note-textarea"> <?php require_once "../db.php"; $notes = NoteDB::getInstance()->get_notes_by_user_name('Stephen'); if (0 === $notes->count()) { echo '<div class="error">'; echo 'The person '; echo 'Stephen'; echo 'is not found. Please check the spelling and try again.'; echo '</div>'; } else { while ($notes->valid()) { $row = $notes->current(); echo '<div id="note">'; echo 'Date Created: '; echo $row['DATE_CREATED']; echo '<br>'; // Saved notes appear here echo $row['CONTENT'];
<?php /* ================================================================================ REQUEST OF ADD NOTES -> GET VALUES WITH AJAX author : ELihu Alejandro Cruz Albores version : 1.0.4 ================================================================================ */ include "../NoteDB.php"; $id = $_POST['id']; $text = $_POST['text']; $key_note = $_POST['key_note']; //Instance $Conection = new NoteDB("WebProject", "localhost", "root", " "); $data = $Conection->addNote($id, $text, $key_note);
<?php require_once "db.php"; if (isset($_POST['action'])) { switch ($_POST['action']) { case 'insert_note': $noteContent = $_POST["noteContent"]; $userDate = $_POST["userDate"]; echo $noteContent; NoteDB::getInstance()->insert_note(1, $noteContent, $userDate); break; } }
<?php /* ================================================================================ REQUEST OF EDIT USERS -> GET VALUES WITH AJAX author : ELihu Alejandro Cruz Albores version : 1.0.4 ================================================================================ */ include "../NoteDB.php"; $id = $_POST['id']; //Instance $Conection = new NoteDB("WebProject", "localhost", "root", " "); $data = $Conection->removeIdNote($id);
<?php /* ================================================================================ REQUEST OF UPDATE USERS -> GET VALUES WITH AJAX author : ELihu Alejandro Cruz Albores version : 1.0.4 ================================================================================ */ include "../NoteDB.php"; $id = $_POST['id']; $text = $_POST['text']; $key_note = $_POST['key_note']; //Instance $Conection = new NoteDB("WebProject", "localhost", "root", " "); $data = $Conection->updateNotes($id, $text, $key_note);
<?php /* ================================================================================ REQUEST OF REMOVE USERS -> GET VALUES WITH AJAX author : ELihu Alejandro Cruz Albores version : 1.0.4 ================================================================================ */ include "../NoteDB.php"; $id = $_POST['id']; $key_note = $_POST['key_note']; //Instance $Conection = new NoteDB("WebProject", "localhost", "root", " "); $data = $Conection->removeNote($id, $key_note);