Lojong: Tibetan 7 Point Mind Training

buddhism; // select a collection (analogous to a relational database's table) $collection = $db->lojong; if (isset($_POST['slogan'])) { $slogan = $_POST['slogan']; $commentator = $_POST['commentator']; $comment = $_POST['comments']; //echo "

".$_POST['slogan']."

"; $obj = array( "slogan" => $slogan, "author" => $commentator, "comment" => $comment ); $collection->insert($obj); } // find everything in the collection $query = array("author" => "Chogyam Trungpa"); $cursor = $collection->find($query); echo $cursor->count(); // iterate through the results foreach ($cursor as $obj) { echo "

".$obj["slogan"] ."

\n"; echo "

".$obj["comment"] ." -- ".$obj["author"]."

\n"; } ?> Add a slogan