Hi, I am new to mongoDB but I have some knowledge of php, for my project I have been asked to make a online quiz in php and the database to store the quiz and username and password should be in mongoDB, if any knows how to use mongoDB properly please get in touch? I need help to link my php quiz to a mongoDB database. Who ever can , will be rewarded once the website is up and working for my university project . Thank you in advance
Doctrine has a mongo db mapper. therefore, you could use doctrine and the extension for mongo and not worry about any implementation details of persisting data to mongo. That is one option. Though I’m sure there are also other php mongo abstraction layers or you could just use the php mongo driver directly which I believe is a PECL extension which would be easy enough to install via the following method.
To set up a local development environment I would recommend using puphpet.com to create a script that provisions a vagrant box with php, apache and mongo. That way you don’t need to worry about installing this on your host machine and can just run it off of a vm.
Thanks for your advice, do you think you will be able to walk me through it step by step, would these programs help fix up my php and mongoDB codes, because I have manage to connect the database from the university @localhost but just found it had to save the username and password . Such as $user=$collection->findOne(array(“username”=>$username));
You will very rarely receive a “step by step” guide or help from an online community and if you do, it will be only for relatively easy tasks. Putting together a “Quiz Website” isn’t a relatively easy task. As an online community, although we’d love to do it, trying to hold your hand through the whole process would be way too time consuming for us both.
If you need to get the project done fast, find a PHP framework that works with MongoDB (or with Doctrine ODM) and start from there. (And don’t ask us for the answer to the question, what frameworks work with MongoDB or Doctrine. Search for an answer. You’ll find it for sure!). If you know your way around PHP, then you should also have some knowledge about how one or two frameworks work. If not, then you should get learning and this is a nice little project to start with. I’d suggest using a micro-framework, to speed things up.
As you are going forward with your project, when you run into problems, start searching. If you then can’t find your answer, then come here and ask specific questions. That is where we can help you best. But first, try yourself to solve your problem.
In other words, an online community can help those best, who have put in some effort to help themselves first.
The first step is to set-up an environment that includes php, apache, and mongo. That can be done multiple ways but the way I recommend is using puphpet.
Using Laravel, Symfony, or just about any modernized framework will require composer. So you probably want to become familiar with that as well if this is the route you will be taking. Also make sure that composer is installed on the environment.
Lol thanks il keep searching for answers and il look at the stuff you recommended
Thanks a lot for the advice , I figure how to use those websites and see how it goes from there
My only reason for suggesting a micro-framework is the lower learning curve. Symfony and Laravel are big, with steep learning curves and might be overkill, if he only needs a relatively simple website/ application.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.