get('rg_Student'); // $arr = array('isError' => false , 'data' => $posts); // echo json_encode($arr); // //print_r($posts); // //echo $mysql->num_rows(); // number of rows returned // }catch(Exception $e){ // echo 'Caught exception: ', $e->getMessage(); // } // // get all post titles and authors // try{ // //$posts = $mysql->get('posts', array('title', 'author')); // // or // $posts = $mysql->get('posts', 'title,author'); // print_r($posts); // echo $mysql->last_query(); // the raw query that was ran // }catch(Exception $e){ // echo 'Caught exception: ', $e->getMessage(); // } // get one post try{ $host = "localhost"; $username = "eis_sync"; $password = "P@ssw0rd@2017"; $mysql = new MySQL($host, $username, $password, $db ); $post = $mysql->query($sql,true); $arr = array('isError' => false , 'data' => $post); echo json_encode($arr); //print_r($post); }catch(Exception $e){ echo 'Caught exception: ', $e->getMessage(); } // // get post with an id of 1 // try{ // $post = $mysql->where('id', 1)->get('posts'); // // or // $post = $mysql->where(array('id', 1))->get('posts'); // print_r($post); // }catch(Exception $e){ // echo 'Caught exception: ', $e->getMessage(); // } // // get all posts by the author of "John Doe" // try{ // $posts = $mysql->where(array('author' => 'John Doe'))->get('posts'); // print_r($posts); // }catch(Exception $e){ // echo 'Caught exception: ', $e->getMessage(); // } // // insert post // try{ // $mysql->insert('posts', array('title' => 'New Title', 'content' => 'post content', 'author' => 'Matthew Loberg')); // echo $mysql->insert_id(); // id of newly inserted post // }catch(Exception $e){ // echo 'Caught exception: ', $e->getMessage(); // } // // update post 1 // try{ // $mysql->where('id', 1)->update('posts', array('title' => 'New Title')); // }catch(Exception $e){ // echo 'Caught exception: ', $e->getMessage(); // } // // delete post 1 // try{ // $mysql->where('id', 1)->delete('posts'); // }catch(Exception $e){ // echo 'Caught exception: ', $e->getMessage(); // } ?>