I'm working on Jelastic
cloud platform and I'm trying to use MongoDB
for my php website.
The only query that worked correctly for me was the $db.collection.find();
..
I tried executing my code exactly after the connection as following, but it also didn't work !!
<?php
$host = "mongodb-env-4080143.whelastic.net";
$username = "admin";
$password = "*****";
try{
$conn = new Mongo($host, array("username" => $username, "password" => $password));
$db = $conn->selectDB('e-shoppingoMongo');
if ($conn){
echo " it is working ";
$collection = new MongoCollection($db, 'users');
$db->users->insert({
fname : "kkkk", lname: "Ash", password: "x" ,
email: "x@x.com",phoneNo: 000 ,company: "x",
country: "b",city:"x",street:"x"});
}
}catch( Exception $e){
echo "<center><h1>Doesn't work</h1></center>";
exit;
}
?>
Please tell me what am I doing wrong ?!?!? I really appreciate any help ..